Repository: wpCloud/wp-stateless
Branch: latest
Commit: 2a64ef967e77
Files: 2439
Total size: 15.3 MB
Directory structure:
gitextract_pxv_oo3a/
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── publish-release.yml
│ └── security-scan.yml
├── .gitignore
├── LICENSE
├── SECURITY.md
├── changelog.txt
├── changes.md
├── composer.json
├── l10n.php
├── lib/
│ ├── Google/
│ │ ├── CHANGELOG.md
│ │ ├── CODE_OF_CONDUCT.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── SECURITY.md
│ │ ├── UPGRADING.md
│ │ ├── composer.json
│ │ ├── phpstan.neon.dist
│ │ ├── src/
│ │ │ ├── AccessToken/
│ │ │ │ ├── Revoke.php
│ │ │ │ └── Verify.php
│ │ │ ├── AuthHandler/
│ │ │ │ ├── AuthHandlerFactory.php
│ │ │ │ ├── Guzzle6AuthHandler.php
│ │ │ │ └── Guzzle7AuthHandler.php
│ │ │ ├── Client.php
│ │ │ ├── Collection.php
│ │ │ ├── Exception.php
│ │ │ ├── Http/
│ │ │ │ ├── Batch.php
│ │ │ │ ├── MediaFileUpload.php
│ │ │ │ └── REST.php
│ │ │ ├── Model.php
│ │ │ ├── Service/
│ │ │ │ ├── Exception.php
│ │ │ │ ├── README.md
│ │ │ │ └── Resource.php
│ │ │ ├── Service.php
│ │ │ ├── Task/
│ │ │ │ ├── Composer.php
│ │ │ │ ├── Exception.php
│ │ │ │ ├── Retryable.php
│ │ │ │ └── Runner.php
│ │ │ ├── Utils/
│ │ │ │ └── UriTemplate.php
│ │ │ └── aliases.php
│ │ └── vendor/
│ │ ├── autoload.php
│ │ ├── bin/
│ │ │ └── google-cloud-batch
│ │ ├── brick/
│ │ │ └── math/
│ │ │ ├── CHANGELOG.md
│ │ │ ├── LICENSE
│ │ │ ├── composer.json
│ │ │ ├── psalm-baseline.xml
│ │ │ └── src/
│ │ │ ├── BigDecimal.php
│ │ │ ├── BigInteger.php
│ │ │ ├── BigNumber.php
│ │ │ ├── BigRational.php
│ │ │ ├── Exception/
│ │ │ │ ├── DivisionByZeroException.php
│ │ │ │ ├── IntegerOverflowException.php
│ │ │ │ ├── MathException.php
│ │ │ │ ├── NegativeNumberException.php
│ │ │ │ ├── NumberFormatException.php
│ │ │ │ └── RoundingNecessaryException.php
│ │ │ ├── Internal/
│ │ │ │ ├── Calculator/
│ │ │ │ │ ├── BcMathCalculator.php
│ │ │ │ │ ├── GmpCalculator.php
│ │ │ │ │ └── NativeCalculator.php
│ │ │ │ └── Calculator.php
│ │ │ └── RoundingMode.php
│ │ ├── composer/
│ │ │ ├── ClassLoader.php
│ │ │ ├── InstalledVersions.php
│ │ │ ├── LICENSE
│ │ │ ├── autoload_classmap.php
│ │ │ ├── autoload_files.php
│ │ │ ├── autoload_namespaces.php
│ │ │ ├── autoload_psr4.php
│ │ │ ├── autoload_real.php
│ │ │ ├── autoload_static.php
│ │ │ ├── installed.json
│ │ │ ├── installed.php
│ │ │ └── platform_check.php
│ │ ├── firebase/
│ │ │ └── php-jwt/
│ │ │ ├── CHANGELOG.md
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src/
│ │ │ ├── BeforeValidException.php
│ │ │ ├── CachedKeySet.php
│ │ │ ├── ExpiredException.php
│ │ │ ├── JWK.php
│ │ │ ├── JWT.php
│ │ │ ├── JWTExceptionWithPayloadInterface.php
│ │ │ ├── Key.php
│ │ │ └── SignatureInvalidException.php
│ │ ├── google/
│ │ │ ├── apiclient-services/
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── SECURITY.md
│ │ │ │ ├── autoload.php
│ │ │ │ ├── composer.json
│ │ │ │ └── src/
│ │ │ │ ├── Storage/
│ │ │ │ │ ├── AdvanceRelocateBucketOperationRequest.php
│ │ │ │ │ ├── AnywhereCache.php
│ │ │ │ │ ├── AnywhereCaches.php
│ │ │ │ │ ├── Bucket.php
│ │ │ │ │ ├── BucketAccessControl.php
│ │ │ │ │ ├── BucketAccessControlProjectTeam.php
│ │ │ │ │ ├── BucketAccessControls.php
│ │ │ │ │ ├── BucketAutoclass.php
│ │ │ │ │ ├── BucketBilling.php
│ │ │ │ │ ├── BucketCors.php
│ │ │ │ │ ├── BucketCustomPlacementConfig.php
│ │ │ │ │ ├── BucketEncryption.php
│ │ │ │ │ ├── BucketEncryptionCustomerManagedEncryptionEnforcementConfig.php
│ │ │ │ │ ├── BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig.php
│ │ │ │ │ ├── BucketEncryptionGoogleManagedEncryptionEnforcementConfig.php
│ │ │ │ │ ├── BucketHierarchicalNamespace.php
│ │ │ │ │ ├── BucketIamConfiguration.php
│ │ │ │ │ ├── BucketIamConfigurationBucketPolicyOnly.php
│ │ │ │ │ ├── BucketIamConfigurationUniformBucketLevelAccess.php
│ │ │ │ │ ├── BucketIpFilter.php
│ │ │ │ │ ├── BucketIpFilterPublicNetworkSource.php
│ │ │ │ │ ├── BucketIpFilterVpcNetworkSources.php
│ │ │ │ │ ├── BucketLifecycle.php
│ │ │ │ │ ├── BucketLifecycleRule.php
│ │ │ │ │ ├── BucketLifecycleRuleAction.php
│ │ │ │ │ ├── BucketLifecycleRuleCondition.php
│ │ │ │ │ ├── BucketLogging.php
│ │ │ │ │ ├── BucketObjectRetention.php
│ │ │ │ │ ├── BucketOwner.php
│ │ │ │ │ ├── BucketRetentionPolicy.php
│ │ │ │ │ ├── BucketSoftDeletePolicy.php
│ │ │ │ │ ├── BucketStorageLayout.php
│ │ │ │ │ ├── BucketStorageLayoutCustomPlacementConfig.php
│ │ │ │ │ ├── BucketStorageLayoutHierarchicalNamespace.php
│ │ │ │ │ ├── BucketVersioning.php
│ │ │ │ │ ├── BucketWebsite.php
│ │ │ │ │ ├── Buckets.php
│ │ │ │ │ ├── BulkRestoreObjectsRequest.php
│ │ │ │ │ ├── Channel.php
│ │ │ │ │ ├── ComposeRequest.php
│ │ │ │ │ ├── ComposeRequestSourceObjects.php
│ │ │ │ │ ├── ComposeRequestSourceObjectsObjectPreconditions.php
│ │ │ │ │ ├── Expr.php
│ │ │ │ │ ├── Folder.php
│ │ │ │ │ ├── FolderPendingRenameInfo.php
│ │ │ │ │ ├── Folders.php
│ │ │ │ │ ├── GoogleLongrunningListOperationsResponse.php
│ │ │ │ │ ├── GoogleLongrunningOperation.php
│ │ │ │ │ ├── GoogleRpcStatus.php
│ │ │ │ │ ├── HmacKey.php
│ │ │ │ │ ├── HmacKeyMetadata.php
│ │ │ │ │ ├── HmacKeysMetadata.php
│ │ │ │ │ ├── ManagedFolder.php
│ │ │ │ │ ├── ManagedFolders.php
│ │ │ │ │ ├── Notification.php
│ │ │ │ │ ├── Notifications.php
│ │ │ │ │ ├── ObjectAccessControl.php
│ │ │ │ │ ├── ObjectAccessControlProjectTeam.php
│ │ │ │ │ ├── ObjectAccessControls.php
│ │ │ │ │ ├── ObjectCustomContextPayload.php
│ │ │ │ │ ├── Objects.php
│ │ │ │ │ ├── Policy.php
│ │ │ │ │ ├── PolicyBindings.php
│ │ │ │ │ ├── RelocateBucketRequest.php
│ │ │ │ │ ├── RelocateBucketRequestDestinationCustomPlacementConfig.php
│ │ │ │ │ ├── Resource/
│ │ │ │ │ │ ├── AnywhereCache.php
│ │ │ │ │ │ ├── AnywhereCaches.php
│ │ │ │ │ │ ├── BucketAccessControls.php
│ │ │ │ │ │ ├── Buckets.php
│ │ │ │ │ │ ├── Channels.php
│ │ │ │ │ │ ├── DefaultObjectAccessControls.php
│ │ │ │ │ │ ├── Folders.php
│ │ │ │ │ │ ├── ManagedFolders.php
│ │ │ │ │ │ ├── Notifications.php
│ │ │ │ │ │ ├── ObjectAccessControls.php
│ │ │ │ │ │ ├── Objects.php
│ │ │ │ │ │ ├── Operations.php
│ │ │ │ │ │ ├── Projects.php
│ │ │ │ │ │ ├── ProjectsHmacKeys.php
│ │ │ │ │ │ └── ProjectsServiceAccount.php
│ │ │ │ │ ├── RewriteResponse.php
│ │ │ │ │ ├── ServiceAccount.php
│ │ │ │ │ ├── StorageObject.php
│ │ │ │ │ ├── StorageObjectContexts.php
│ │ │ │ │ ├── StorageObjectCustomerEncryption.php
│ │ │ │ │ ├── StorageObjectOwner.php
│ │ │ │ │ ├── StorageObjectRetention.php
│ │ │ │ │ └── TestIamPermissionsResponse.php
│ │ │ │ └── Storage.php
│ │ │ ├── auth/
│ │ │ │ ├── .repo-metadata.json
│ │ │ │ ├── COPYING
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── SECURITY.md
│ │ │ │ ├── VERSION
│ │ │ │ ├── composer.json
│ │ │ │ └── src/
│ │ │ │ ├── AccessToken.php
│ │ │ │ ├── ApplicationDefaultCredentials.php
│ │ │ │ ├── Cache/
│ │ │ │ │ ├── FileSystemCacheItemPool.php
│ │ │ │ │ ├── InvalidArgumentException.php
│ │ │ │ │ ├── MemoryCacheItemPool.php
│ │ │ │ │ ├── SysVCacheItemPool.php
│ │ │ │ │ └── TypedItem.php
│ │ │ │ ├── CacheTrait.php
│ │ │ │ ├── CredentialSource/
│ │ │ │ │ ├── AwsNativeSource.php
│ │ │ │ │ ├── ExecutableSource.php
│ │ │ │ │ ├── FileSource.php
│ │ │ │ │ └── UrlSource.php
│ │ │ │ ├── Credentials/
│ │ │ │ │ ├── AppIdentityCredentials.php
│ │ │ │ │ ├── ExternalAccountCredentials.php
│ │ │ │ │ ├── GCECredentials.php
│ │ │ │ │ ├── IAMCredentials.php
│ │ │ │ │ ├── ImpersonatedServiceAccountCredentials.php
│ │ │ │ │ ├── InsecureCredentials.php
│ │ │ │ │ ├── ServiceAccountCredentials.php
│ │ │ │ │ ├── ServiceAccountJwtAccessCredentials.php
│ │ │ │ │ └── UserRefreshCredentials.php
│ │ │ │ ├── CredentialsLoader.php
│ │ │ │ ├── ExecutableHandler/
│ │ │ │ │ ├── ExecutableHandler.php
│ │ │ │ │ └── ExecutableResponseError.php
│ │ │ │ ├── ExternalAccountCredentialSourceInterface.php
│ │ │ │ ├── FetchAuthTokenCache.php
│ │ │ │ ├── FetchAuthTokenInterface.php
│ │ │ │ ├── GCECache.php
│ │ │ │ ├── GetQuotaProjectInterface.php
│ │ │ │ ├── GetUniverseDomainInterface.php
│ │ │ │ ├── HttpHandler/
│ │ │ │ │ ├── Guzzle6HttpHandler.php
│ │ │ │ │ ├── Guzzle7HttpHandler.php
│ │ │ │ │ ├── HttpClientCache.php
│ │ │ │ │ └── HttpHandlerFactory.php
│ │ │ │ ├── Iam.php
│ │ │ │ ├── IamSignerTrait.php
│ │ │ │ ├── Logging/
│ │ │ │ │ ├── LoggingTrait.php
│ │ │ │ │ ├── RpcLogEvent.php
│ │ │ │ │ └── StdOutLogger.php
│ │ │ │ ├── MetricsTrait.php
│ │ │ │ ├── Middleware/
│ │ │ │ │ ├── AuthTokenMiddleware.php
│ │ │ │ │ ├── ProxyAuthTokenMiddleware.php
│ │ │ │ │ ├── ScopedAccessTokenMiddleware.php
│ │ │ │ │ └── SimpleMiddleware.php
│ │ │ │ ├── OAuth2.php
│ │ │ │ ├── ProjectIdProviderInterface.php
│ │ │ │ ├── ServiceAccountSignerTrait.php
│ │ │ │ ├── SignBlobInterface.php
│ │ │ │ ├── UpdateMetadataInterface.php
│ │ │ │ └── UpdateMetadataTrait.php
│ │ │ ├── cloud-core/
│ │ │ │ ├── .gitattributes
│ │ │ │ ├── CODE_OF_CONDUCT.md
│ │ │ │ ├── CONTRIBUTING.md
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── SECURITY.md
│ │ │ │ ├── VERSION
│ │ │ │ ├── bin/
│ │ │ │ │ └── google-cloud-batch
│ │ │ │ ├── composer.json
│ │ │ │ ├── perf-bootstrap.php
│ │ │ │ ├── snippet-bootstrap.php
│ │ │ │ ├── src/
│ │ │ │ │ ├── AnonymousCredentials.php
│ │ │ │ │ ├── ApiHelperTrait.php
│ │ │ │ │ ├── ArrayTrait.php
│ │ │ │ │ ├── Batch/
│ │ │ │ │ │ ├── BatchDaemon.php
│ │ │ │ │ │ ├── BatchDaemonTrait.php
│ │ │ │ │ │ ├── BatchJob.php
│ │ │ │ │ │ ├── BatchRunner.php
│ │ │ │ │ │ ├── BatchTrait.php
│ │ │ │ │ │ ├── ClosureSerializerInterface.php
│ │ │ │ │ │ ├── ConfigStorageInterface.php
│ │ │ │ │ │ ├── HandleFailureTrait.php
│ │ │ │ │ │ ├── InMemoryConfigStorage.php
│ │ │ │ │ │ ├── InterruptTrait.php
│ │ │ │ │ │ ├── JobConfig.php
│ │ │ │ │ │ ├── JobInterface.php
│ │ │ │ │ │ ├── JobTrait.php
│ │ │ │ │ │ ├── OpisClosureSerializer.php
│ │ │ │ │ │ ├── OpisClosureSerializerV4.php
│ │ │ │ │ │ ├── ProcessItemInterface.php
│ │ │ │ │ │ ├── QueueOverflowException.php
│ │ │ │ │ │ ├── Retry.php
│ │ │ │ │ │ ├── SerializableClientTrait.php
│ │ │ │ │ │ ├── SimpleJob.php
│ │ │ │ │ │ ├── SimpleJobTrait.php
│ │ │ │ │ │ ├── SysvConfigStorage.php
│ │ │ │ │ │ └── SysvProcessor.php
│ │ │ │ │ ├── Blob.php
│ │ │ │ │ ├── ClientTrait.php
│ │ │ │ │ ├── Compute/
│ │ │ │ │ │ ├── Metadata/
│ │ │ │ │ │ │ └── Readers/
│ │ │ │ │ │ │ ├── HttpHandlerReader.php
│ │ │ │ │ │ │ ├── ReaderInterface.php
│ │ │ │ │ │ │ └── StreamReader.php
│ │ │ │ │ │ └── Metadata.php
│ │ │ │ │ ├── ConcurrencyControlTrait.php
│ │ │ │ │ ├── DebugInfoTrait.php
│ │ │ │ │ ├── DetectProjectIdTrait.php
│ │ │ │ │ ├── Duration.php
│ │ │ │ │ ├── EmulatorTrait.php
│ │ │ │ │ ├── Exception/
│ │ │ │ │ │ ├── AbortedException.php
│ │ │ │ │ │ ├── BadRequestException.php
│ │ │ │ │ │ ├── ConflictException.php
│ │ │ │ │ │ ├── DeadlineExceededException.php
│ │ │ │ │ │ ├── FailedPreconditionException.php
│ │ │ │ │ │ ├── GoogleException.php
│ │ │ │ │ │ ├── NotFoundException.php
│ │ │ │ │ │ ├── ServerException.php
│ │ │ │ │ │ └── ServiceException.php
│ │ │ │ │ ├── ExponentialBackoff.php
│ │ │ │ │ ├── GeoPoint.php
│ │ │ │ │ ├── GrpcRequestWrapper.php
│ │ │ │ │ ├── GrpcTrait.php
│ │ │ │ │ ├── Iam/
│ │ │ │ │ │ ├── Iam.php
│ │ │ │ │ │ ├── IamConnectionInterface.php
│ │ │ │ │ │ ├── IamManager.php
│ │ │ │ │ │ └── PolicyBuilder.php
│ │ │ │ │ ├── InsecureCredentialsWrapper.php
│ │ │ │ │ ├── Int64.php
│ │ │ │ │ ├── Iterator/
│ │ │ │ │ │ ├── ItemIterator.php
│ │ │ │ │ │ ├── ItemIteratorTrait.php
│ │ │ │ │ │ ├── PageIterator.php
│ │ │ │ │ │ └── PageIteratorTrait.php
│ │ │ │ │ ├── JsonTrait.php
│ │ │ │ │ ├── Lock/
│ │ │ │ │ │ ├── FlockLock.php
│ │ │ │ │ │ ├── LockInterface.php
│ │ │ │ │ │ ├── LockTrait.php
│ │ │ │ │ │ ├── SemaphoreLock.php
│ │ │ │ │ │ └── SymfonyLockAdapter.php
│ │ │ │ │ ├── Logger/
│ │ │ │ │ │ ├── AppEngineFlexFormatter.php
│ │ │ │ │ │ ├── AppEngineFlexFormatterV2.php
│ │ │ │ │ │ ├── AppEngineFlexFormatterV3.php
│ │ │ │ │ │ ├── AppEngineFlexHandler.php
│ │ │ │ │ │ ├── AppEngineFlexHandlerFactory.php
│ │ │ │ │ │ ├── AppEngineFlexHandlerV2.php
│ │ │ │ │ │ ├── AppEngineFlexHandlerV3.php
│ │ │ │ │ │ └── FormatterTrait.php
│ │ │ │ │ ├── LongRunning/
│ │ │ │ │ │ ├── LROTrait.php
│ │ │ │ │ │ ├── LongRunningClientConnection.php
│ │ │ │ │ │ ├── LongRunningConnectionInterface.php
│ │ │ │ │ │ ├── LongRunningOperation.php
│ │ │ │ │ │ └── OperationResponseTrait.php
│ │ │ │ │ ├── OptionsValidator.php
│ │ │ │ │ ├── PhpArray.php
│ │ │ │ │ ├── Report/
│ │ │ │ │ │ ├── CloudRunJobMetadataProvider.php
│ │ │ │ │ │ ├── CloudRunMetadataProvider.php
│ │ │ │ │ │ ├── CloudRunServiceMetadataProvider.php
│ │ │ │ │ │ ├── EmptyMetadataProvider.php
│ │ │ │ │ │ ├── GAEFlexMetadataProvider.php
│ │ │ │ │ │ ├── GAEMetadataProvider.php
│ │ │ │ │ │ ├── GAEStandardMetadataProvider.php
│ │ │ │ │ │ ├── MetadataProviderInterface.php
│ │ │ │ │ │ ├── MetadataProviderUtils.php
│ │ │ │ │ │ └── SimpleMetadataProvider.php
│ │ │ │ │ ├── RequestBuilder.php
│ │ │ │ │ ├── RequestHandler.php
│ │ │ │ │ ├── RequestProcessorTrait.php
│ │ │ │ │ ├── RequestWrapper.php
│ │ │ │ │ ├── RequestWrapperTrait.php
│ │ │ │ │ ├── RestTrait.php
│ │ │ │ │ ├── Retry.php
│ │ │ │ │ ├── RetryDeciderTrait.php
│ │ │ │ │ ├── ServiceBuilder.php
│ │ │ │ │ ├── SysvTrait.php
│ │ │ │ │ ├── Testing/
│ │ │ │ │ │ ├── ArrayHasSameValuesToken.php
│ │ │ │ │ │ ├── CheckForClassTrait.php
│ │ │ │ │ │ ├── DatastoreOperationRefreshTrait.php
│ │ │ │ │ │ ├── FileListFilterIterator.php
│ │ │ │ │ │ ├── GcTestListener.php
│ │ │ │ │ │ ├── GrpcTestTrait.php
│ │ │ │ │ │ ├── KeyPairGenerateTrait.php
│ │ │ │ │ │ ├── Lock/
│ │ │ │ │ │ │ ├── MockGlobals.php
│ │ │ │ │ │ │ └── MockValues.php
│ │ │ │ │ │ ├── README.md
│ │ │ │ │ │ ├── Reflection/
│ │ │ │ │ │ │ ├── DescriptionFactory.php
│ │ │ │ │ │ │ ├── ReflectionHandlerFactory.php
│ │ │ │ │ │ │ └── ReflectionHandlerV6.php
│ │ │ │ │ │ ├── RegexFileFilter.php
│ │ │ │ │ │ ├── Snippet/
│ │ │ │ │ │ │ ├── Container.php
│ │ │ │ │ │ │ ├── Coverage/
│ │ │ │ │ │ │ │ ├── Coverage.php
│ │ │ │ │ │ │ │ ├── ExcludeFilter.php
│ │ │ │ │ │ │ │ ├── Scanner.php
│ │ │ │ │ │ │ │ └── ScannerInterface.php
│ │ │ │ │ │ │ ├── Fixtures.php
│ │ │ │ │ │ │ ├── Parser/
│ │ │ │ │ │ │ │ ├── InvokeResult.php
│ │ │ │ │ │ │ │ ├── Parser.php
│ │ │ │ │ │ │ │ └── Snippet.php
│ │ │ │ │ │ │ ├── SnippetTestCase.php
│ │ │ │ │ │ │ └── keyfile-stub.json
│ │ │ │ │ │ ├── StubTrait.php
│ │ │ │ │ │ ├── System/
│ │ │ │ │ │ │ ├── DeletionQueue.php
│ │ │ │ │ │ │ ├── KeyManager.php
│ │ │ │ │ │ │ └── SystemTestCase.php
│ │ │ │ │ │ └── TestHelpers.php
│ │ │ │ │ ├── TimeTrait.php
│ │ │ │ │ ├── Timestamp.php
│ │ │ │ │ ├── TimestampTrait.php
│ │ │ │ │ ├── Upload/
│ │ │ │ │ │ ├── AbstractUploader.php
│ │ │ │ │ │ ├── MultipartUploader.php
│ │ │ │ │ │ ├── ResumableUploader.php
│ │ │ │ │ │ ├── SignedUrlUploader.php
│ │ │ │ │ │ └── StreamableUploader.php
│ │ │ │ │ ├── UriTrait.php
│ │ │ │ │ ├── ValidateTrait.php
│ │ │ │ │ ├── ValueMapperTrait.php
│ │ │ │ │ └── WhitelistTrait.php
│ │ │ │ ├── system-bootstrap.php
│ │ │ │ └── unit-bootstrap.php
│ │ │ ├── cloud-storage/
│ │ │ │ ├── .gitattributes
│ │ │ │ ├── CODE_OF_CONDUCT.md
│ │ │ │ ├── CONTRIBUTING.md
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── SECURITY.md
│ │ │ │ ├── VERSION
│ │ │ │ ├── composer.json
│ │ │ │ └── src/
│ │ │ │ ├── Acl.php
│ │ │ │ ├── Bucket.php
│ │ │ │ ├── BucketIterator.php
│ │ │ │ ├── Connection/
│ │ │ │ │ ├── ConnectionInterface.php
│ │ │ │ │ ├── IamBucket.php
│ │ │ │ │ ├── Rest.php
│ │ │ │ │ ├── RetryTrait.php
│ │ │ │ │ └── ServiceDefinition/
│ │ │ │ │ └── storage-v1.json
│ │ │ │ ├── CreatedHmacKey.php
│ │ │ │ ├── EncryptionTrait.php
│ │ │ │ ├── HmacKey.php
│ │ │ │ ├── Lifecycle.php
│ │ │ │ ├── Notification.php
│ │ │ │ ├── ObjectIterator.php
│ │ │ │ ├── ObjectPageIterator.php
│ │ │ │ ├── ReadStream.php
│ │ │ │ ├── SigningHelper.php
│ │ │ │ ├── StorageClient.php
│ │ │ │ ├── StorageObject.php
│ │ │ │ ├── StreamWrapper.php
│ │ │ │ └── WriteStream.php
│ │ │ ├── common-protos/
│ │ │ │ ├── CHANGELOG.md
│ │ │ │ ├── CODE_OF_CONDUCT.md
│ │ │ │ ├── CONTRIBUTING.md
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── SECURITY.md
│ │ │ │ ├── VERSION
│ │ │ │ ├── composer.json
│ │ │ │ ├── metadata/
│ │ │ │ │ ├── Api/
│ │ │ │ │ │ ├── Annotations.php
│ │ │ │ │ │ ├── Auth.php
│ │ │ │ │ │ ├── Backend.php
│ │ │ │ │ │ ├── Billing.php
│ │ │ │ │ │ ├── Client.php
│ │ │ │ │ │ ├── ConfigChange.php
│ │ │ │ │ │ ├── Consumer.php
│ │ │ │ │ │ ├── Context.php
│ │ │ │ │ │ ├── Control.php
│ │ │ │ │ │ ├── Distribution.php
│ │ │ │ │ │ ├── Documentation.php
│ │ │ │ │ │ ├── Endpoint.php
│ │ │ │ │ │ ├── ErrorReason.php
│ │ │ │ │ │ ├── FieldBehavior.php
│ │ │ │ │ │ ├── FieldInfo.php
│ │ │ │ │ │ ├── Http.php
│ │ │ │ │ │ ├── Httpbody.php
│ │ │ │ │ │ ├── Label.php
│ │ │ │ │ │ ├── LaunchStage.php
│ │ │ │ │ │ ├── Log.php
│ │ │ │ │ │ ├── Logging.php
│ │ │ │ │ │ ├── Metric.php
│ │ │ │ │ │ ├── MonitoredResource.php
│ │ │ │ │ │ ├── Monitoring.php
│ │ │ │ │ │ ├── Policy.php
│ │ │ │ │ │ ├── Quota.php
│ │ │ │ │ │ ├── Resource.php
│ │ │ │ │ │ ├── Routing.php
│ │ │ │ │ │ ├── Service.php
│ │ │ │ │ │ ├── SourceInfo.php
│ │ │ │ │ │ ├── SystemParameter.php
│ │ │ │ │ │ ├── Usage.php
│ │ │ │ │ │ └── Visibility.php
│ │ │ │ │ ├── Cloud/
│ │ │ │ │ │ ├── ExtendedOperations.php
│ │ │ │ │ │ └── Location/
│ │ │ │ │ │ └── Locations.php
│ │ │ │ │ ├── Google/
│ │ │ │ │ │ ├── Iam/
│ │ │ │ │ │ │ └── V1/
│ │ │ │ │ │ │ ├── IamPolicy.php
│ │ │ │ │ │ │ ├── Logging/
│ │ │ │ │ │ │ │ └── AuditData.php
│ │ │ │ │ │ │ ├── Options.php
│ │ │ │ │ │ │ ├── Policy.php
│ │ │ │ │ │ │ └── ResourcePolicyMember.php
│ │ │ │ │ │ └── Logging/
│ │ │ │ │ │ └── Type/
│ │ │ │ │ │ ├── HttpRequest.php
│ │ │ │ │ │ └── LogSeverity.php
│ │ │ │ │ ├── Iam/
│ │ │ │ │ │ └── V1/
│ │ │ │ │ │ ├── IamPolicy.php
│ │ │ │ │ │ ├── Logging/
│ │ │ │ │ │ │ └── AuditData.php
│ │ │ │ │ │ ├── Options.php
│ │ │ │ │ │ ├── Policy.php
│ │ │ │ │ │ └── ResourcePolicyMember.php
│ │ │ │ │ ├── Logging/
│ │ │ │ │ │ └── Type/
│ │ │ │ │ │ ├── HttpRequest.php
│ │ │ │ │ │ └── LogSeverity.php
│ │ │ │ │ ├── Rpc/
│ │ │ │ │ │ ├── Code.php
│ │ │ │ │ │ ├── Context/
│ │ │ │ │ │ │ ├── AttributeContext.php
│ │ │ │ │ │ │ └── AuditContext.php
│ │ │ │ │ │ ├── ErrorDetails.php
│ │ │ │ │ │ └── Status.php
│ │ │ │ │ └── Type/
│ │ │ │ │ ├── CalendarPeriod.php
│ │ │ │ │ ├── Color.php
│ │ │ │ │ ├── Date.php
│ │ │ │ │ ├── Datetime.php
│ │ │ │ │ ├── Dayofweek.php
│ │ │ │ │ ├── Decimal.php
│ │ │ │ │ ├── Expr.php
│ │ │ │ │ ├── Fraction.php
│ │ │ │ │ ├── Interval.php
│ │ │ │ │ ├── Latlng.php
│ │ │ │ │ ├── LocalizedText.php
│ │ │ │ │ ├── Money.php
│ │ │ │ │ ├── Month.php
│ │ │ │ │ ├── PhoneNumber.php
│ │ │ │ │ ├── PostalAddress.php
│ │ │ │ │ ├── Quaternion.php
│ │ │ │ │ └── Timeofday.php
│ │ │ │ ├── renovate.json
│ │ │ │ └── src/
│ │ │ │ ├── Api/
│ │ │ │ │ ├── Advice.php
│ │ │ │ │ ├── AuthProvider.php
│ │ │ │ │ ├── AuthRequirement.php
│ │ │ │ │ ├── Authentication.php
│ │ │ │ │ ├── AuthenticationRule.php
│ │ │ │ │ ├── Backend.php
│ │ │ │ │ ├── BackendRule/
│ │ │ │ │ │ └── PathTranslation.php
│ │ │ │ │ ├── BackendRule.php
│ │ │ │ │ ├── Billing/
│ │ │ │ │ │ └── BillingDestination.php
│ │ │ │ │ ├── Billing.php
│ │ │ │ │ ├── ChangeType.php
│ │ │ │ │ ├── ClientLibraryDestination.php
│ │ │ │ │ ├── ClientLibraryOrganization.php
│ │ │ │ │ ├── ClientLibrarySettings.php
│ │ │ │ │ ├── CommonLanguageSettings.php
│ │ │ │ │ ├── ConfigChange.php
│ │ │ │ │ ├── Context.php
│ │ │ │ │ ├── ContextRule.php
│ │ │ │ │ ├── Control.php
│ │ │ │ │ ├── CppSettings.php
│ │ │ │ │ ├── CustomHttpPattern.php
│ │ │ │ │ ├── Distribution/
│ │ │ │ │ │ ├── BucketOptions/
│ │ │ │ │ │ │ ├── Explicit.php
│ │ │ │ │ │ │ ├── Exponential.php
│ │ │ │ │ │ │ └── Linear.php
│ │ │ │ │ │ ├── BucketOptions.php
│ │ │ │ │ │ ├── Exemplar.php
│ │ │ │ │ │ └── Range.php
│ │ │ │ │ ├── Distribution.php
│ │ │ │ │ ├── Documentation.php
│ │ │ │ │ ├── DocumentationRule.php
│ │ │ │ │ ├── DotnetSettings.php
│ │ │ │ │ ├── Endpoint.php
│ │ │ │ │ ├── ErrorReason.php
│ │ │ │ │ ├── FieldBehavior.php
│ │ │ │ │ ├── FieldInfo/
│ │ │ │ │ │ └── Format.php
│ │ │ │ │ ├── FieldInfo.php
│ │ │ │ │ ├── FieldPolicy.php
│ │ │ │ │ ├── GoSettings.php
│ │ │ │ │ ├── Http.php
│ │ │ │ │ ├── HttpBody.php
│ │ │ │ │ ├── HttpRule.php
│ │ │ │ │ ├── JavaSettings.php
│ │ │ │ │ ├── JwtLocation.php
│ │ │ │ │ ├── LabelDescriptor/
│ │ │ │ │ │ └── ValueType.php
│ │ │ │ │ ├── LabelDescriptor.php
│ │ │ │ │ ├── LaunchStage.php
│ │ │ │ │ ├── LogDescriptor.php
│ │ │ │ │ ├── Logging/
│ │ │ │ │ │ └── LoggingDestination.php
│ │ │ │ │ ├── Logging.php
│ │ │ │ │ ├── MethodPolicy.php
│ │ │ │ │ ├── MethodSettings/
│ │ │ │ │ │ └── LongRunning.php
│ │ │ │ │ ├── MethodSettings.php
│ │ │ │ │ ├── Metric.php
│ │ │ │ │ ├── MetricDescriptor/
│ │ │ │ │ │ ├── MetricDescriptorMetadata/
│ │ │ │ │ │ │ └── TimeSeriesResourceHierarchyLevel.php
│ │ │ │ │ │ ├── MetricDescriptorMetadata.php
│ │ │ │ │ │ ├── MetricKind.php
│ │ │ │ │ │ └── ValueType.php
│ │ │ │ │ ├── MetricDescriptor.php
│ │ │ │ │ ├── MetricRule.php
│ │ │ │ │ ├── MonitoredResource.php
│ │ │ │ │ ├── MonitoredResourceDescriptor.php
│ │ │ │ │ ├── MonitoredResourceMetadata.php
│ │ │ │ │ ├── Monitoring/
│ │ │ │ │ │ └── MonitoringDestination.php
│ │ │ │ │ ├── Monitoring.php
│ │ │ │ │ ├── NodeSettings.php
│ │ │ │ │ ├── OAuthRequirements.php
│ │ │ │ │ ├── Page.php
│ │ │ │ │ ├── PhpSettings.php
│ │ │ │ │ ├── ProjectProperties.php
│ │ │ │ │ ├── Property/
│ │ │ │ │ │ └── PropertyType.php
│ │ │ │ │ ├── Property.php
│ │ │ │ │ ├── Publishing.php
│ │ │ │ │ ├── PythonSettings/
│ │ │ │ │ │ └── ExperimentalFeatures.php
│ │ │ │ │ ├── PythonSettings.php
│ │ │ │ │ ├── Quota.php
│ │ │ │ │ ├── QuotaLimit.php
│ │ │ │ │ ├── ResourceDescriptor/
│ │ │ │ │ │ ├── History.php
│ │ │ │ │ │ └── Style.php
│ │ │ │ │ ├── ResourceDescriptor.php
│ │ │ │ │ ├── ResourceReference.php
│ │ │ │ │ ├── RoutingParameter.php
│ │ │ │ │ ├── RoutingRule.php
│ │ │ │ │ ├── RubySettings.php
│ │ │ │ │ ├── SelectiveGapicGeneration.php
│ │ │ │ │ ├── Service.php
│ │ │ │ │ ├── SourceInfo.php
│ │ │ │ │ ├── SystemParameter.php
│ │ │ │ │ ├── SystemParameterRule.php
│ │ │ │ │ ├── SystemParameters.php
│ │ │ │ │ ├── TypeReference.php
│ │ │ │ │ ├── Usage.php
│ │ │ │ │ ├── UsageRule.php
│ │ │ │ │ ├── Visibility.php
│ │ │ │ │ └── VisibilityRule.php
│ │ │ │ ├── Cloud/
│ │ │ │ │ ├── Iam/
│ │ │ │ │ │ └── V1/
│ │ │ │ │ │ ├── AuditConfig.php
│ │ │ │ │ │ ├── AuditConfigDelta/
│ │ │ │ │ │ │ └── Action.php
│ │ │ │ │ │ ├── AuditConfigDelta.php
│ │ │ │ │ │ ├── AuditLogConfig/
│ │ │ │ │ │ │ └── LogType.php
│ │ │ │ │ │ ├── AuditLogConfig.php
│ │ │ │ │ │ ├── Binding.php
│ │ │ │ │ │ ├── BindingDelta/
│ │ │ │ │ │ │ └── Action.php
│ │ │ │ │ │ ├── BindingDelta.php
│ │ │ │ │ │ ├── GetIamPolicyRequest.php
│ │ │ │ │ │ ├── GetPolicyOptions.php
│ │ │ │ │ │ ├── Policy.php
│ │ │ │ │ │ ├── PolicyDelta.php
│ │ │ │ │ │ ├── ResourcePolicyMember.php
│ │ │ │ │ │ ├── SetIamPolicyRequest.php
│ │ │ │ │ │ ├── TestIamPermissionsRequest.php
│ │ │ │ │ │ └── TestIamPermissionsResponse.php
│ │ │ │ │ ├── Location/
│ │ │ │ │ │ ├── GetLocationRequest.php
│ │ │ │ │ │ ├── ListLocationsRequest.php
│ │ │ │ │ │ ├── ListLocationsResponse.php
│ │ │ │ │ │ └── Location.php
│ │ │ │ │ ├── Logging/
│ │ │ │ │ │ └── Type/
│ │ │ │ │ │ ├── HttpRequest.php
│ │ │ │ │ │ └── LogSeverity.php
│ │ │ │ │ └── OperationResponseMapping.php
│ │ │ │ ├── Iam/
│ │ │ │ │ └── V1/
│ │ │ │ │ └── Logging/
│ │ │ │ │ └── AuditData.php
│ │ │ │ ├── Rpc/
│ │ │ │ │ ├── BadRequest/
│ │ │ │ │ │ └── FieldViolation.php
│ │ │ │ │ ├── BadRequest.php
│ │ │ │ │ ├── Code.php
│ │ │ │ │ ├── Context/
│ │ │ │ │ │ ├── AttributeContext/
│ │ │ │ │ │ │ ├── Api.php
│ │ │ │ │ │ │ ├── Auth.php
│ │ │ │ │ │ │ ├── Peer.php
│ │ │ │ │ │ │ ├── Request.php
│ │ │ │ │ │ │ ├── Resource.php
│ │ │ │ │ │ │ └── Response.php
│ │ │ │ │ │ ├── AttributeContext.php
│ │ │ │ │ │ └── AuditContext.php
│ │ │ │ │ ├── DebugInfo.php
│ │ │ │ │ ├── ErrorInfo.php
│ │ │ │ │ ├── Help/
│ │ │ │ │ │ └── Link.php
│ │ │ │ │ ├── Help.php
│ │ │ │ │ ├── LocalizedMessage.php
│ │ │ │ │ ├── PreconditionFailure/
│ │ │ │ │ │ └── Violation.php
│ │ │ │ │ ├── PreconditionFailure.php
│ │ │ │ │ ├── QuotaFailure/
│ │ │ │ │ │ └── Violation.php
│ │ │ │ │ ├── QuotaFailure.php
│ │ │ │ │ ├── RequestInfo.php
│ │ │ │ │ ├── ResourceInfo.php
│ │ │ │ │ ├── RetryInfo.php
│ │ │ │ │ └── Status.php
│ │ │ │ └── Type/
│ │ │ │ ├── CalendarPeriod.php
│ │ │ │ ├── Color.php
│ │ │ │ ├── Date.php
│ │ │ │ ├── DateTime.php
│ │ │ │ ├── DayOfWeek.php
│ │ │ │ ├── Decimal.php
│ │ │ │ ├── Expr.php
│ │ │ │ ├── Fraction.php
│ │ │ │ ├── Interval.php
│ │ │ │ ├── LatLng.php
│ │ │ │ ├── LocalizedText.php
│ │ │ │ ├── Money.php
│ │ │ │ ├── Month.php
│ │ │ │ ├── PhoneNumber/
│ │ │ │ │ └── ShortCode.php
│ │ │ │ ├── PhoneNumber.php
│ │ │ │ ├── PostalAddress.php
│ │ │ │ ├── Quaternion.php
│ │ │ │ ├── TimeOfDay.php
│ │ │ │ └── TimeZone.php
│ │ │ ├── gax/
│ │ │ │ ├── .repo-metadata.json
│ │ │ │ ├── CHANGELOG.md
│ │ │ │ ├── CODE_OF_CONDUCT.md
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── SECURITY.md
│ │ │ │ ├── VERSION
│ │ │ │ ├── composer.json
│ │ │ │ ├── metadata/
│ │ │ │ │ ├── ApiCore/
│ │ │ │ │ │ └── Testing/
│ │ │ │ │ │ └── Mocks.php
│ │ │ │ │ ├── Google/
│ │ │ │ │ │ └── ApiCore/
│ │ │ │ │ │ └── Tests/
│ │ │ │ │ │ └── Unit/
│ │ │ │ │ │ └── Example.php
│ │ │ │ │ └── README.md
│ │ │ │ ├── phpstan.neon.dist
│ │ │ │ ├── phpunit.xml.dist
│ │ │ │ ├── renovate.json
│ │ │ │ └── src/
│ │ │ │ ├── AgentHeader.php
│ │ │ │ ├── ApiException.php
│ │ │ │ ├── ApiKeyHeaderCredentials.php
│ │ │ │ ├── ApiStatus.php
│ │ │ │ ├── ArrayTrait.php
│ │ │ │ ├── BidiStream.php
│ │ │ │ ├── Call.php
│ │ │ │ ├── ClientOptionsTrait.php
│ │ │ │ ├── ClientStream.php
│ │ │ │ ├── CredentialsWrapper.php
│ │ │ │ ├── FixedSizeCollection.php
│ │ │ │ ├── GPBLabel.php
│ │ │ │ ├── GPBType.php
│ │ │ │ ├── GapicClientTrait.php
│ │ │ │ ├── GrpcSupportTrait.php
│ │ │ │ ├── HeaderCredentialsInterface.php
│ │ │ │ ├── InsecureCredentialsWrapper.php
│ │ │ │ ├── InsecureRequestBuilder.php
│ │ │ │ ├── Middleware/
│ │ │ │ │ ├── CredentialsWrapperMiddleware.php
│ │ │ │ │ ├── FixedHeaderMiddleware.php
│ │ │ │ │ ├── MiddlewareInterface.php
│ │ │ │ │ ├── OperationsMiddleware.php
│ │ │ │ │ ├── OptionsFilterMiddleware.php
│ │ │ │ │ ├── PagedMiddleware.php
│ │ │ │ │ ├── RequestAutoPopulationMiddleware.php
│ │ │ │ │ ├── ResponseMetadataMiddleware.php
│ │ │ │ │ ├── RetryMiddleware.php
│ │ │ │ │ └── TransportCallMiddleware.php
│ │ │ │ ├── OperationResponse.php
│ │ │ │ ├── Options/
│ │ │ │ │ ├── CallOptions.php
│ │ │ │ │ ├── ClientOptions.php
│ │ │ │ │ ├── OptionsInterface.php
│ │ │ │ │ ├── OptionsTrait.php
│ │ │ │ │ ├── TransportOptions/
│ │ │ │ │ │ ├── GrpcFallbackTransportOptions.php
│ │ │ │ │ │ ├── GrpcTransportOptions.php
│ │ │ │ │ │ └── RestTransportOptions.php
│ │ │ │ │ └── TransportOptions.php
│ │ │ │ ├── Page.php
│ │ │ │ ├── PageStreamingDescriptor.php
│ │ │ │ ├── PagedListResponse.php
│ │ │ │ ├── PathTemplate.php
│ │ │ │ ├── PollingTrait.php
│ │ │ │ ├── RequestBuilder.php
│ │ │ │ ├── RequestParamsHeaderDescriptor.php
│ │ │ │ ├── ResourceHelperTrait.php
│ │ │ │ ├── ResourceTemplate/
│ │ │ │ │ ├── AbsoluteResourceTemplate.php
│ │ │ │ │ ├── Parser.php
│ │ │ │ │ ├── RelativeResourceTemplate.php
│ │ │ │ │ ├── ResourceTemplateInterface.php
│ │ │ │ │ └── Segment.php
│ │ │ │ ├── RetrySettings.php
│ │ │ │ ├── Serializer.php
│ │ │ │ ├── ServerStream.php
│ │ │ │ ├── ServerStreamingCallInterface.php
│ │ │ │ ├── ServiceAddressTrait.php
│ │ │ │ ├── Testing/
│ │ │ │ │ ├── GeneratedTest.php
│ │ │ │ │ ├── MessageAwareArrayComparator.php
│ │ │ │ │ ├── MessageAwareExporter.php
│ │ │ │ │ ├── MockBidiStreamingCall.php
│ │ │ │ │ ├── MockClientStreamingCall.php
│ │ │ │ │ ├── MockGrpcTransport.php
│ │ │ │ │ ├── MockRequest.php
│ │ │ │ │ ├── MockRequestBody.php
│ │ │ │ │ ├── MockResponse.php
│ │ │ │ │ ├── MockServerStreamingCall.php
│ │ │ │ │ ├── MockStatus.php
│ │ │ │ │ ├── MockStubTrait.php
│ │ │ │ │ ├── MockTransport.php
│ │ │ │ │ ├── MockUnaryCall.php
│ │ │ │ │ ├── ProtobufGPBEmptyComparator.php
│ │ │ │ │ ├── ProtobufMessageComparator.php
│ │ │ │ │ ├── ReceivedRequest.php
│ │ │ │ │ ├── SerializationTrait.php
│ │ │ │ │ └── mocks.proto
│ │ │ │ ├── Transport/
│ │ │ │ │ ├── Grpc/
│ │ │ │ │ │ ├── ForwardingCall.php
│ │ │ │ │ │ ├── ForwardingServerStreamingCall.php
│ │ │ │ │ │ ├── ForwardingUnaryCall.php
│ │ │ │ │ │ ├── ServerStreamingCallWrapper.php
│ │ │ │ │ │ └── UnaryInterceptorInterface.php
│ │ │ │ │ ├── GrpcFallbackTransport.php
│ │ │ │ │ ├── GrpcTransport.php
│ │ │ │ │ ├── HttpUnaryTransportTrait.php
│ │ │ │ │ ├── Rest/
│ │ │ │ │ │ ├── JsonStreamDecoder.php
│ │ │ │ │ │ └── RestServerStreamingCall.php
│ │ │ │ │ ├── RestTransport.php
│ │ │ │ │ └── TransportInterface.php
│ │ │ │ ├── UriTrait.php
│ │ │ │ ├── ValidationException.php
│ │ │ │ ├── ValidationTrait.php
│ │ │ │ └── Version.php
│ │ │ ├── grpc-gcp/
│ │ │ │ ├── .github/
│ │ │ │ │ ├── release-please.yml
│ │ │ │ │ └── workflows/
│ │ │ │ │ └── tests.yml
│ │ │ │ ├── .gitmodules
│ │ │ │ ├── .php_cs.dist
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── cloudprober/
│ │ │ │ │ ├── bins/
│ │ │ │ │ │ └── opt/
│ │ │ │ │ │ └── grpc_php_plugin
│ │ │ │ │ ├── cloudprober.cfg
│ │ │ │ │ ├── codegen.sh
│ │ │ │ │ ├── composer.json
│ │ │ │ │ └── grpc_gpc_prober/
│ │ │ │ │ ├── firestore_probes.php
│ │ │ │ │ ├── prober.php
│ │ │ │ │ ├── spanner_probes.php
│ │ │ │ │ └── stackdriver_util.php
│ │ │ │ ├── composer.json
│ │ │ │ ├── doc/
│ │ │ │ │ └── gRPC-client-user-guide.md
│ │ │ │ └── src/
│ │ │ │ ├── ChannelRef.php
│ │ │ │ ├── Config.php
│ │ │ │ ├── CreatedByDeserializeCheck.php
│ │ │ │ ├── GCPBidiStreamingCall.php
│ │ │ │ ├── GCPCallInvoker.php
│ │ │ │ ├── GCPClientStreamCall.php
│ │ │ │ ├── GCPServerStreamCall.php
│ │ │ │ ├── GCPUnaryCall.php
│ │ │ │ ├── GcpBaseCall.php
│ │ │ │ ├── GcpExtensionChannel.php
│ │ │ │ ├── generated/
│ │ │ │ │ ├── GPBMetadata/
│ │ │ │ │ │ └── GrpcGcp.php
│ │ │ │ │ └── Grpc/
│ │ │ │ │ └── Gcp/
│ │ │ │ │ ├── AffinityConfig.php
│ │ │ │ │ ├── AffinityConfig_Command.php
│ │ │ │ │ ├── ApiConfig.php
│ │ │ │ │ ├── ChannelPoolConfig.php
│ │ │ │ │ └── MethodConfig.php
│ │ │ │ └── grpc_gcp.proto
│ │ │ ├── longrunning/
│ │ │ │ ├── .gitattributes
│ │ │ │ ├── CODE_OF_CONDUCT.md
│ │ │ │ ├── CONTRIBUTING.md
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── SECURITY.md
│ │ │ │ ├── VERSION
│ │ │ │ ├── composer.json
│ │ │ │ ├── metadata/
│ │ │ │ │ ├── Longrunning/
│ │ │ │ │ │ └── Operations.php
│ │ │ │ │ └── README.md
│ │ │ │ └── src/
│ │ │ │ ├── ApiCore/
│ │ │ │ │ └── LongRunning/
│ │ │ │ │ ├── Gapic/
│ │ │ │ │ │ └── OperationsGapicClient.php
│ │ │ │ │ └── OperationsClient.php
│ │ │ │ └── LongRunning/
│ │ │ │ ├── CancelOperationRequest.php
│ │ │ │ ├── Client/
│ │ │ │ │ └── OperationsClient.php
│ │ │ │ ├── DeleteOperationRequest.php
│ │ │ │ ├── Gapic/
│ │ │ │ │ └── OperationsGapicClient.php
│ │ │ │ ├── GetOperationRequest.php
│ │ │ │ ├── ListOperationsRequest.php
│ │ │ │ ├── ListOperationsResponse.php
│ │ │ │ ├── Operation.php
│ │ │ │ ├── OperationInfo.php
│ │ │ │ ├── OperationsClient.php
│ │ │ │ ├── OperationsGrpcClient.php
│ │ │ │ ├── WaitOperationRequest.php
│ │ │ │ └── resources/
│ │ │ │ ├── operations_client_config.json
│ │ │ │ ├── operations_descriptor_config.php
│ │ │ │ └── operations_rest_client_config.php
│ │ │ └── protobuf/
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src/
│ │ │ ├── GPBMetadata/
│ │ │ │ └── Google/
│ │ │ │ └── Protobuf/
│ │ │ │ ├── Any.php
│ │ │ │ ├── Api.php
│ │ │ │ ├── Duration.php
│ │ │ │ ├── FieldMask.php
│ │ │ │ ├── GPBEmpty.php
│ │ │ │ ├── Internal/
│ │ │ │ │ └── Descriptor.php
│ │ │ │ ├── SourceContext.php
│ │ │ │ ├── Struct.php
│ │ │ │ ├── Timestamp.php
│ │ │ │ ├── Type.php
│ │ │ │ └── Wrappers.php
│ │ │ ├── Google/
│ │ │ │ └── Protobuf/
│ │ │ │ ├── Any.php
│ │ │ │ ├── Api.php
│ │ │ │ ├── BoolValue.php
│ │ │ │ ├── BytesValue.php
│ │ │ │ ├── Descriptor.php
│ │ │ │ ├── DescriptorPool.php
│ │ │ │ ├── DoubleValue.php
│ │ │ │ ├── Duration.php
│ │ │ │ ├── Enum.php
│ │ │ │ ├── EnumDescriptor.php
│ │ │ │ ├── EnumValue.php
│ │ │ │ ├── EnumValueDescriptor.php
│ │ │ │ ├── Field/
│ │ │ │ │ ├── Cardinality.php
│ │ │ │ │ └── Kind.php
│ │ │ │ ├── Field.php
│ │ │ │ ├── FieldDescriptor.php
│ │ │ │ ├── FieldMask.php
│ │ │ │ ├── Field_Cardinality.php
│ │ │ │ ├── Field_Kind.php
│ │ │ │ ├── FloatValue.php
│ │ │ │ ├── GPBEmpty.php
│ │ │ │ ├── Int32Value.php
│ │ │ │ ├── Int64Value.php
│ │ │ │ ├── Internal/
│ │ │ │ │ ├── AnyBase.php
│ │ │ │ │ ├── CodedInputStream.php
│ │ │ │ │ ├── CodedOutputStream.php
│ │ │ │ │ ├── Descriptor.php
│ │ │ │ │ ├── DescriptorPool.php
│ │ │ │ │ ├── DescriptorProto/
│ │ │ │ │ │ ├── ExtensionRange.php
│ │ │ │ │ │ └── ReservedRange.php
│ │ │ │ │ ├── DescriptorProto.php
│ │ │ │ │ ├── Edition.php
│ │ │ │ │ ├── EnumBuilderContext.php
│ │ │ │ │ ├── EnumDescriptor.php
│ │ │ │ │ ├── EnumDescriptorProto/
│ │ │ │ │ │ └── EnumReservedRange.php
│ │ │ │ │ ├── EnumDescriptorProto.php
│ │ │ │ │ ├── EnumOptions.php
│ │ │ │ │ ├── EnumValueDescriptorProto.php
│ │ │ │ │ ├── EnumValueOptions.php
│ │ │ │ │ ├── ExtensionRangeOptions/
│ │ │ │ │ │ ├── Declaration.php
│ │ │ │ │ │ └── VerificationState.php
│ │ │ │ │ ├── ExtensionRangeOptions.php
│ │ │ │ │ ├── FeatureSet/
│ │ │ │ │ │ ├── EnforceNamingStyle.php
│ │ │ │ │ │ ├── EnumType.php
│ │ │ │ │ │ ├── FieldPresence.php
│ │ │ │ │ │ ├── JsonFormat.php
│ │ │ │ │ │ ├── MessageEncoding.php
│ │ │ │ │ │ ├── RepeatedFieldEncoding.php
│ │ │ │ │ │ ├── Utf8Validation.php
│ │ │ │ │ │ ├── VisibilityFeature/
│ │ │ │ │ │ │ └── DefaultSymbolVisibility.php
│ │ │ │ │ │ └── VisibilityFeature.php
│ │ │ │ │ ├── FeatureSet.php
│ │ │ │ │ ├── FeatureSetDefaults/
│ │ │ │ │ │ └── FeatureSetEditionDefault.php
│ │ │ │ │ ├── FeatureSetDefaults.php
│ │ │ │ │ ├── FieldDescriptor.php
│ │ │ │ │ ├── FieldDescriptorProto/
│ │ │ │ │ │ ├── Label.php
│ │ │ │ │ │ └── Type.php
│ │ │ │ │ ├── FieldDescriptorProto.php
│ │ │ │ │ ├── FieldOptions/
│ │ │ │ │ │ ├── CType.php
│ │ │ │ │ │ ├── EditionDefault.php
│ │ │ │ │ │ ├── FeatureSupport.php
│ │ │ │ │ │ ├── JSType.php
│ │ │ │ │ │ ├── OptionRetention.php
│ │ │ │ │ │ └── OptionTargetType.php
│ │ │ │ │ ├── FieldOptions.php
│ │ │ │ │ ├── FileDescriptor.php
│ │ │ │ │ ├── FileDescriptorProto.php
│ │ │ │ │ ├── FileDescriptorSet.php
│ │ │ │ │ ├── FileOptions/
│ │ │ │ │ │ └── OptimizeMode.php
│ │ │ │ │ ├── FileOptions.php
│ │ │ │ │ ├── GPBDecodeException.php
│ │ │ │ │ ├── GPBJsonWire.php
│ │ │ │ │ ├── GPBLabel.php
│ │ │ │ │ ├── GPBType.php
│ │ │ │ │ ├── GPBUtil.php
│ │ │ │ │ ├── GPBWire.php
│ │ │ │ │ ├── GPBWireType.php
│ │ │ │ │ ├── GeneratedCodeInfo/
│ │ │ │ │ │ ├── Annotation/
│ │ │ │ │ │ │ └── Semantic.php
│ │ │ │ │ │ └── Annotation.php
│ │ │ │ │ ├── GeneratedCodeInfo.php
│ │ │ │ │ ├── GetPublicDescriptorTrait.php
│ │ │ │ │ ├── HasPublicDescriptorTrait.php
│ │ │ │ │ ├── MapEntry.php
│ │ │ │ │ ├── MapField.php
│ │ │ │ │ ├── MapFieldIter.php
│ │ │ │ │ ├── Message.php
│ │ │ │ │ ├── MessageBuilderContext.php
│ │ │ │ │ ├── MessageOptions.php
│ │ │ │ │ ├── MethodDescriptorProto.php
│ │ │ │ │ ├── MethodOptions/
│ │ │ │ │ │ └── IdempotencyLevel.php
│ │ │ │ │ ├── MethodOptions.php
│ │ │ │ │ ├── OneofDescriptor.php
│ │ │ │ │ ├── OneofDescriptorProto.php
│ │ │ │ │ ├── OneofField.php
│ │ │ │ │ ├── OneofOptions.php
│ │ │ │ │ ├── RawInputStream.php
│ │ │ │ │ ├── RepeatedField.php
│ │ │ │ │ ├── RepeatedFieldIter.php
│ │ │ │ │ ├── ServiceDescriptorProto.php
│ │ │ │ │ ├── ServiceOptions.php
│ │ │ │ │ ├── SourceCodeInfo/
│ │ │ │ │ │ └── Location.php
│ │ │ │ │ ├── SourceCodeInfo.php
│ │ │ │ │ ├── SymbolVisibility.php
│ │ │ │ │ ├── TimestampBase.php
│ │ │ │ │ ├── UninterpretedOption/
│ │ │ │ │ │ └── NamePart.php
│ │ │ │ │ └── UninterpretedOption.php
│ │ │ │ ├── ListValue.php
│ │ │ │ ├── Method.php
│ │ │ │ ├── Mixin.php
│ │ │ │ ├── NullValue.php
│ │ │ │ ├── OneofDescriptor.php
│ │ │ │ ├── Option.php
│ │ │ │ ├── PrintOptions.php
│ │ │ │ ├── RepeatedField.php
│ │ │ │ ├── SourceContext.php
│ │ │ │ ├── StringValue.php
│ │ │ │ ├── Struct.php
│ │ │ │ ├── Syntax.php
│ │ │ │ ├── Timestamp.php
│ │ │ │ ├── Type.php
│ │ │ │ ├── UInt32Value.php
│ │ │ │ ├── UInt64Value.php
│ │ │ │ └── Value.php
│ │ │ └── phpdoc.dist.xml
│ │ ├── grpc/
│ │ │ └── grpc/
│ │ │ ├── LICENSE
│ │ │ ├── MAINTAINERS.md
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ ├── etc/
│ │ │ │ └── roots.pem
│ │ │ └── src/
│ │ │ └── lib/
│ │ │ ├── AbstractCall.php
│ │ │ ├── BaseStub.php
│ │ │ ├── BidiStreamingCall.php
│ │ │ ├── CallInvoker.php
│ │ │ ├── ClientStreamingCall.php
│ │ │ ├── DefaultCallInvoker.php
│ │ │ ├── Interceptor.php
│ │ │ ├── Internal/
│ │ │ │ └── InterceptorChannel.php
│ │ │ ├── MethodDescriptor.php
│ │ │ ├── RpcServer.php
│ │ │ ├── ServerCallReader.php
│ │ │ ├── ServerCallWriter.php
│ │ │ ├── ServerContext.php
│ │ │ ├── ServerStreamingCall.php
│ │ │ ├── Status.php
│ │ │ └── UnaryCall.php
│ │ ├── guzzlehttp/
│ │ │ ├── guzzle/
│ │ │ │ ├── CHANGELOG.md
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── UPGRADING.md
│ │ │ │ ├── composer.json
│ │ │ │ └── src/
│ │ │ │ ├── BodySummarizer.php
│ │ │ │ ├── BodySummarizerInterface.php
│ │ │ │ ├── Client.php
│ │ │ │ ├── ClientInterface.php
│ │ │ │ ├── ClientTrait.php
│ │ │ │ ├── Cookie/
│ │ │ │ │ ├── CookieJar.php
│ │ │ │ │ ├── CookieJarInterface.php
│ │ │ │ │ ├── FileCookieJar.php
│ │ │ │ │ ├── SessionCookieJar.php
│ │ │ │ │ └── SetCookie.php
│ │ │ │ ├── Exception/
│ │ │ │ │ ├── BadResponseException.php
│ │ │ │ │ ├── ClientException.php
│ │ │ │ │ ├── ConnectException.php
│ │ │ │ │ ├── GuzzleException.php
│ │ │ │ │ ├── InvalidArgumentException.php
│ │ │ │ │ ├── RequestException.php
│ │ │ │ │ ├── ServerException.php
│ │ │ │ │ ├── TooManyRedirectsException.php
│ │ │ │ │ └── TransferException.php
│ │ │ │ ├── Handler/
│ │ │ │ │ ├── CurlFactory.php
│ │ │ │ │ ├── CurlFactoryInterface.php
│ │ │ │ │ ├── CurlHandler.php
│ │ │ │ │ ├── CurlMultiHandler.php
│ │ │ │ │ ├── EasyHandle.php
│ │ │ │ │ ├── HeaderProcessor.php
│ │ │ │ │ ├── MockHandler.php
│ │ │ │ │ ├── Proxy.php
│ │ │ │ │ └── StreamHandler.php
│ │ │ │ ├── HandlerStack.php
│ │ │ │ ├── MessageFormatter.php
│ │ │ │ ├── MessageFormatterInterface.php
│ │ │ │ ├── Middleware.php
│ │ │ │ ├── Pool.php
│ │ │ │ ├── PrepareBodyMiddleware.php
│ │ │ │ ├── RedirectMiddleware.php
│ │ │ │ ├── RequestOptions.php
│ │ │ │ ├── RetryMiddleware.php
│ │ │ │ ├── TransferStats.php
│ │ │ │ ├── Utils.php
│ │ │ │ ├── functions.php
│ │ │ │ └── functions_include.php
│ │ │ ├── promises/
│ │ │ │ ├── CHANGELOG.md
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── composer.json
│ │ │ │ └── src/
│ │ │ │ ├── AggregateException.php
│ │ │ │ ├── CancellationException.php
│ │ │ │ ├── Coroutine.php
│ │ │ │ ├── Create.php
│ │ │ │ ├── Each.php
│ │ │ │ ├── EachPromise.php
│ │ │ │ ├── FulfilledPromise.php
│ │ │ │ ├── Is.php
│ │ │ │ ├── Promise.php
│ │ │ │ ├── PromiseInterface.php
│ │ │ │ ├── PromisorInterface.php
│ │ │ │ ├── RejectedPromise.php
│ │ │ │ ├── RejectionException.php
│ │ │ │ ├── TaskQueue.php
│ │ │ │ ├── TaskQueueInterface.php
│ │ │ │ └── Utils.php
│ │ │ └── psr7/
│ │ │ ├── CHANGELOG.md
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src/
│ │ │ ├── AppendStream.php
│ │ │ ├── BufferStream.php
│ │ │ ├── CachingStream.php
│ │ │ ├── DroppingStream.php
│ │ │ ├── Exception/
│ │ │ │ └── MalformedUriException.php
│ │ │ ├── FnStream.php
│ │ │ ├── Header.php
│ │ │ ├── HttpFactory.php
│ │ │ ├── InflateStream.php
│ │ │ ├── LazyOpenStream.php
│ │ │ ├── LimitStream.php
│ │ │ ├── Message.php
│ │ │ ├── MessageTrait.php
│ │ │ ├── MimeType.php
│ │ │ ├── MultipartStream.php
│ │ │ ├── NoSeekStream.php
│ │ │ ├── PumpStream.php
│ │ │ ├── Query.php
│ │ │ ├── Request.php
│ │ │ ├── Response.php
│ │ │ ├── Rfc7230.php
│ │ │ ├── ServerRequest.php
│ │ │ ├── Stream.php
│ │ │ ├── StreamDecoratorTrait.php
│ │ │ ├── StreamWrapper.php
│ │ │ ├── UploadedFile.php
│ │ │ ├── Uri.php
│ │ │ ├── UriComparator.php
│ │ │ ├── UriNormalizer.php
│ │ │ ├── UriResolver.php
│ │ │ └── Utils.php
│ │ ├── monolog/
│ │ │ └── monolog/
│ │ │ ├── CHANGELOG.md
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src/
│ │ │ └── Monolog/
│ │ │ ├── Attribute/
│ │ │ │ ├── AsMonologProcessor.php
│ │ │ │ └── WithMonologChannel.php
│ │ │ ├── DateTimeImmutable.php
│ │ │ ├── ErrorHandler.php
│ │ │ ├── Formatter/
│ │ │ │ ├── ChromePHPFormatter.php
│ │ │ │ ├── ElasticaFormatter.php
│ │ │ │ ├── ElasticsearchFormatter.php
│ │ │ │ ├── FlowdockFormatter.php
│ │ │ │ ├── FluentdFormatter.php
│ │ │ │ ├── FormatterInterface.php
│ │ │ │ ├── GelfMessageFormatter.php
│ │ │ │ ├── GoogleCloudLoggingFormatter.php
│ │ │ │ ├── HtmlFormatter.php
│ │ │ │ ├── JsonFormatter.php
│ │ │ │ ├── LineFormatter.php
│ │ │ │ ├── LogglyFormatter.php
│ │ │ │ ├── LogmaticFormatter.php
│ │ │ │ ├── LogstashFormatter.php
│ │ │ │ ├── MongoDBFormatter.php
│ │ │ │ ├── NormalizerFormatter.php
│ │ │ │ ├── ScalarFormatter.php
│ │ │ │ ├── SyslogFormatter.php
│ │ │ │ └── WildfireFormatter.php
│ │ │ ├── Handler/
│ │ │ │ ├── AbstractHandler.php
│ │ │ │ ├── AbstractProcessingHandler.php
│ │ │ │ ├── AbstractSyslogHandler.php
│ │ │ │ ├── AmqpHandler.php
│ │ │ │ ├── BrowserConsoleHandler.php
│ │ │ │ ├── BufferHandler.php
│ │ │ │ ├── ChromePHPHandler.php
│ │ │ │ ├── CouchDBHandler.php
│ │ │ │ ├── CubeHandler.php
│ │ │ │ ├── Curl/
│ │ │ │ │ └── Util.php
│ │ │ │ ├── DeduplicationHandler.php
│ │ │ │ ├── DoctrineCouchDBHandler.php
│ │ │ │ ├── DynamoDbHandler.php
│ │ │ │ ├── ElasticaHandler.php
│ │ │ │ ├── ElasticsearchHandler.php
│ │ │ │ ├── ErrorLogHandler.php
│ │ │ │ ├── FallbackGroupHandler.php
│ │ │ │ ├── FilterHandler.php
│ │ │ │ ├── FingersCrossed/
│ │ │ │ │ ├── ActivationStrategyInterface.php
│ │ │ │ │ ├── ChannelLevelActivationStrategy.php
│ │ │ │ │ └── ErrorLevelActivationStrategy.php
│ │ │ │ ├── FingersCrossedHandler.php
│ │ │ │ ├── FirePHPHandler.php
│ │ │ │ ├── FleepHookHandler.php
│ │ │ │ ├── FlowdockHandler.php
│ │ │ │ ├── FormattableHandlerInterface.php
│ │ │ │ ├── FormattableHandlerTrait.php
│ │ │ │ ├── GelfHandler.php
│ │ │ │ ├── GroupHandler.php
│ │ │ │ ├── Handler.php
│ │ │ │ ├── HandlerInterface.php
│ │ │ │ ├── HandlerWrapper.php
│ │ │ │ ├── IFTTTHandler.php
│ │ │ │ ├── InsightOpsHandler.php
│ │ │ │ ├── LogEntriesHandler.php
│ │ │ │ ├── LogglyHandler.php
│ │ │ │ ├── LogmaticHandler.php
│ │ │ │ ├── MailHandler.php
│ │ │ │ ├── MandrillHandler.php
│ │ │ │ ├── MissingExtensionException.php
│ │ │ │ ├── MongoDBHandler.php
│ │ │ │ ├── NativeMailerHandler.php
│ │ │ │ ├── NewRelicHandler.php
│ │ │ │ ├── NoopHandler.php
│ │ │ │ ├── NullHandler.php
│ │ │ │ ├── OverflowHandler.php
│ │ │ │ ├── PHPConsoleHandler.php
│ │ │ │ ├── ProcessHandler.php
│ │ │ │ ├── ProcessableHandlerInterface.php
│ │ │ │ ├── ProcessableHandlerTrait.php
│ │ │ │ ├── PsrHandler.php
│ │ │ │ ├── PushoverHandler.php
│ │ │ │ ├── RedisHandler.php
│ │ │ │ ├── RedisPubSubHandler.php
│ │ │ │ ├── RollbarHandler.php
│ │ │ │ ├── RotatingFileHandler.php
│ │ │ │ ├── SamplingHandler.php
│ │ │ │ ├── SendGridHandler.php
│ │ │ │ ├── Slack/
│ │ │ │ │ └── SlackRecord.php
│ │ │ │ ├── SlackHandler.php
│ │ │ │ ├── SlackWebhookHandler.php
│ │ │ │ ├── SocketHandler.php
│ │ │ │ ├── SqsHandler.php
│ │ │ │ ├── StreamHandler.php
│ │ │ │ ├── SymfonyMailerHandler.php
│ │ │ │ ├── SyslogHandler.php
│ │ │ │ ├── SyslogUdp/
│ │ │ │ │ └── UdpSocket.php
│ │ │ │ ├── SyslogUdpHandler.php
│ │ │ │ ├── TelegramBotHandler.php
│ │ │ │ ├── TestHandler.php
│ │ │ │ ├── WebRequestRecognizerTrait.php
│ │ │ │ ├── WhatFailureGroupHandler.php
│ │ │ │ └── ZendMonitorHandler.php
│ │ │ ├── JsonSerializableDateTimeImmutable.php
│ │ │ ├── Level.php
│ │ │ ├── LogRecord.php
│ │ │ ├── Logger.php
│ │ │ ├── Processor/
│ │ │ │ ├── ClosureContextProcessor.php
│ │ │ │ ├── GitProcessor.php
│ │ │ │ ├── HostnameProcessor.php
│ │ │ │ ├── IntrospectionProcessor.php
│ │ │ │ ├── LoadAverageProcessor.php
│ │ │ │ ├── MemoryPeakUsageProcessor.php
│ │ │ │ ├── MemoryProcessor.php
│ │ │ │ ├── MemoryUsageProcessor.php
│ │ │ │ ├── MercurialProcessor.php
│ │ │ │ ├── ProcessIdProcessor.php
│ │ │ │ ├── ProcessorInterface.php
│ │ │ │ ├── PsrLogMessageProcessor.php
│ │ │ │ ├── TagProcessor.php
│ │ │ │ ├── UidProcessor.php
│ │ │ │ └── WebProcessor.php
│ │ │ ├── Registry.php
│ │ │ ├── ResettableInterface.php
│ │ │ ├── SignalHandler.php
│ │ │ ├── Test/
│ │ │ │ ├── MonologTestCase.php
│ │ │ │ └── TestCase.php
│ │ │ └── Utils.php
│ │ ├── paragonie/
│ │ │ ├── constant_time_encoding/
│ │ │ │ ├── LICENSE.txt
│ │ │ │ ├── README.md
│ │ │ │ ├── composer.json
│ │ │ │ └── src/
│ │ │ │ ├── Base32.php
│ │ │ │ ├── Base32Hex.php
│ │ │ │ ├── Base64.php
│ │ │ │ ├── Base64DotSlash.php
│ │ │ │ ├── Base64DotSlashOrdered.php
│ │ │ │ ├── Base64UrlSafe.php
│ │ │ │ ├── Binary.php
│ │ │ │ ├── EncoderInterface.php
│ │ │ │ ├── Encoding.php
│ │ │ │ ├── Hex.php
│ │ │ │ └── RFC4648.php
│ │ │ └── random_compat/
│ │ │ ├── LICENSE
│ │ │ ├── build-phar.sh
│ │ │ ├── composer.json
│ │ │ ├── dist/
│ │ │ │ ├── random_compat.phar.pubkey
│ │ │ │ └── random_compat.phar.pubkey.asc
│ │ │ ├── lib/
│ │ │ │ └── random.php
│ │ │ ├── other/
│ │ │ │ └── build_phar.php
│ │ │ ├── psalm-autoload.php
│ │ │ └── psalm.xml
│ │ ├── phpseclib/
│ │ │ └── phpseclib/
│ │ │ ├── AUTHORS
│ │ │ ├── BACKERS.md
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── SECURITY.md
│ │ │ ├── composer.json
│ │ │ └── phpseclib/
│ │ │ ├── Common/
│ │ │ │ └── Functions/
│ │ │ │ └── Strings.php
│ │ │ ├── Crypt/
│ │ │ │ ├── AES.php
│ │ │ │ ├── Blowfish.php
│ │ │ │ ├── ChaCha20.php
│ │ │ │ ├── Common/
│ │ │ │ │ ├── AsymmetricKey.php
│ │ │ │ │ ├── BlockCipher.php
│ │ │ │ │ ├── Formats/
│ │ │ │ │ │ ├── Keys/
│ │ │ │ │ │ │ ├── JWK.php
│ │ │ │ │ │ │ ├── OpenSSH.php
│ │ │ │ │ │ │ ├── PKCS.php
│ │ │ │ │ │ │ ├── PKCS1.php
│ │ │ │ │ │ │ ├── PKCS8.php
│ │ │ │ │ │ │ └── PuTTY.php
│ │ │ │ │ │ └── Signature/
│ │ │ │ │ │ └── Raw.php
│ │ │ │ │ ├── PrivateKey.php
│ │ │ │ │ ├── PublicKey.php
│ │ │ │ │ ├── StreamCipher.php
│ │ │ │ │ ├── SymmetricKey.php
│ │ │ │ │ └── Traits/
│ │ │ │ │ ├── Fingerprint.php
│ │ │ │ │ └── PasswordProtected.php
│ │ │ │ ├── DES.php
│ │ │ │ ├── DH/
│ │ │ │ │ ├── Formats/
│ │ │ │ │ │ └── Keys/
│ │ │ │ │ │ ├── PKCS1.php
│ │ │ │ │ │ └── PKCS8.php
│ │ │ │ │ ├── Parameters.php
│ │ │ │ │ ├── PrivateKey.php
│ │ │ │ │ └── PublicKey.php
│ │ │ │ ├── DH.php
│ │ │ │ ├── DSA/
│ │ │ │ │ ├── Formats/
│ │ │ │ │ │ ├── Keys/
│ │ │ │ │ │ │ ├── OpenSSH.php
│ │ │ │ │ │ │ ├── PKCS1.php
│ │ │ │ │ │ │ ├── PKCS8.php
│ │ │ │ │ │ │ ├── PuTTY.php
│ │ │ │ │ │ │ ├── Raw.php
│ │ │ │ │ │ │ └── XML.php
│ │ │ │ │ │ └── Signature/
│ │ │ │ │ │ ├── ASN1.php
│ │ │ │ │ │ ├── Raw.php
│ │ │ │ │ │ └── SSH2.php
│ │ │ │ │ ├── Parameters.php
│ │ │ │ │ ├── PrivateKey.php
│ │ │ │ │ └── PublicKey.php
│ │ │ │ ├── DSA.php
│ │ │ │ ├── EC/
│ │ │ │ │ ├── BaseCurves/
│ │ │ │ │ │ ├── Base.php
│ │ │ │ │ │ ├── Binary.php
│ │ │ │ │ │ ├── KoblitzPrime.php
│ │ │ │ │ │ ├── Montgomery.php
│ │ │ │ │ │ ├── Prime.php
│ │ │ │ │ │ └── TwistedEdwards.php
│ │ │ │ │ ├── Curves/
│ │ │ │ │ │ ├── Curve25519.php
│ │ │ │ │ │ ├── Curve448.php
│ │ │ │ │ │ ├── Ed25519.php
│ │ │ │ │ │ ├── Ed448.php
│ │ │ │ │ │ ├── brainpoolP160r1.php
│ │ │ │ │ │ ├── brainpoolP160t1.php
│ │ │ │ │ │ ├── brainpoolP192r1.php
│ │ │ │ │ │ ├── brainpoolP192t1.php
│ │ │ │ │ │ ├── brainpoolP224r1.php
│ │ │ │ │ │ ├── brainpoolP224t1.php
│ │ │ │ │ │ ├── brainpoolP256r1.php
│ │ │ │ │ │ ├── brainpoolP256t1.php
│ │ │ │ │ │ ├── brainpoolP320r1.php
│ │ │ │ │ │ ├── brainpoolP320t1.php
│ │ │ │ │ │ ├── brainpoolP384r1.php
│ │ │ │ │ │ ├── brainpoolP384t1.php
│ │ │ │ │ │ ├── brainpoolP512r1.php
│ │ │ │ │ │ ├── brainpoolP512t1.php
│ │ │ │ │ │ ├── nistb233.php
│ │ │ │ │ │ ├── nistb409.php
│ │ │ │ │ │ ├── nistk163.php
│ │ │ │ │ │ ├── nistk233.php
│ │ │ │ │ │ ├── nistk283.php
│ │ │ │ │ │ ├── nistk409.php
│ │ │ │ │ │ ├── nistp192.php
│ │ │ │ │ │ ├── nistp224.php
│ │ │ │ │ │ ├── nistp256.php
│ │ │ │ │ │ ├── nistp384.php
│ │ │ │ │ │ ├── nistp521.php
│ │ │ │ │ │ ├── nistt571.php
│ │ │ │ │ │ ├── prime192v1.php
│ │ │ │ │ │ ├── prime192v2.php
│ │ │ │ │ │ ├── prime192v3.php
│ │ │ │ │ │ ├── prime239v1.php
│ │ │ │ │ │ ├── prime239v2.php
│ │ │ │ │ │ ├── prime239v3.php
│ │ │ │ │ │ ├── prime256v1.php
│ │ │ │ │ │ ├── secp112r1.php
│ │ │ │ │ │ ├── secp112r2.php
│ │ │ │ │ │ ├── secp128r1.php
│ │ │ │ │ │ ├── secp128r2.php
│ │ │ │ │ │ ├── secp160k1.php
│ │ │ │ │ │ ├── secp160r1.php
│ │ │ │ │ │ ├── secp160r2.php
│ │ │ │ │ │ ├── secp192k1.php
│ │ │ │ │ │ ├── secp192r1.php
│ │ │ │ │ │ ├── secp224k1.php
│ │ │ │ │ │ ├── secp224r1.php
│ │ │ │ │ │ ├── secp256k1.php
│ │ │ │ │ │ ├── secp256r1.php
│ │ │ │ │ │ ├── secp384r1.php
│ │ │ │ │ │ ├── secp521r1.php
│ │ │ │ │ │ ├── sect113r1.php
│ │ │ │ │ │ ├── sect113r2.php
│ │ │ │ │ │ ├── sect131r1.php
│ │ │ │ │ │ ├── sect131r2.php
│ │ │ │ │ │ ├── sect163k1.php
│ │ │ │ │ │ ├── sect163r1.php
│ │ │ │ │ │ ├── sect163r2.php
│ │ │ │ │ │ ├── sect193r1.php
│ │ │ │ │ │ ├── sect193r2.php
│ │ │ │ │ │ ├── sect233k1.php
│ │ │ │ │ │ ├── sect233r1.php
│ │ │ │ │ │ ├── sect239k1.php
│ │ │ │ │ │ ├── sect283k1.php
│ │ │ │ │ │ ├── sect283r1.php
│ │ │ │ │ │ ├── sect409k1.php
│ │ │ │ │ │ ├── sect409r1.php
│ │ │ │ │ │ ├── sect571k1.php
│ │ │ │ │ │ └── sect571r1.php
│ │ │ │ │ ├── Formats/
│ │ │ │ │ │ ├── Keys/
│ │ │ │ │ │ │ ├── Common.php
│ │ │ │ │ │ │ ├── JWK.php
│ │ │ │ │ │ │ ├── MontgomeryPrivate.php
│ │ │ │ │ │ │ ├── MontgomeryPublic.php
│ │ │ │ │ │ │ ├── OpenSSH.php
│ │ │ │ │ │ │ ├── PKCS1.php
│ │ │ │ │ │ │ ├── PKCS8.php
│ │ │ │ │ │ │ ├── PuTTY.php
│ │ │ │ │ │ │ ├── XML.php
│ │ │ │ │ │ │ └── libsodium.php
│ │ │ │ │ │ └── Signature/
│ │ │ │ │ │ ├── ASN1.php
│ │ │ │ │ │ ├── IEEE.php
│ │ │ │ │ │ ├── Raw.php
│ │ │ │ │ │ └── SSH2.php
│ │ │ │ │ ├── Parameters.php
│ │ │ │ │ ├── PrivateKey.php
│ │ │ │ │ └── PublicKey.php
│ │ │ │ ├── EC.php
│ │ │ │ ├── Hash.php
│ │ │ │ ├── PublicKeyLoader.php
│ │ │ │ ├── RC2.php
│ │ │ │ ├── RC4.php
│ │ │ │ ├── RSA/
│ │ │ │ │ ├── Formats/
│ │ │ │ │ │ └── Keys/
│ │ │ │ │ │ ├── JWK.php
│ │ │ │ │ │ ├── MSBLOB.php
│ │ │ │ │ │ ├── OpenSSH.php
│ │ │ │ │ │ ├── PKCS1.php
│ │ │ │ │ │ ├── PKCS8.php
│ │ │ │ │ │ ├── PSS.php
│ │ │ │ │ │ ├── PuTTY.php
│ │ │ │ │ │ ├── Raw.php
│ │ │ │ │ │ └── XML.php
│ │ │ │ │ ├── PrivateKey.php
│ │ │ │ │ └── PublicKey.php
│ │ │ │ ├── RSA.php
│ │ │ │ ├── Random.php
│ │ │ │ ├── Rijndael.php
│ │ │ │ ├── Salsa20.php
│ │ │ │ ├── TripleDES.php
│ │ │ │ └── Twofish.php
│ │ │ ├── Exception/
│ │ │ │ ├── BadConfigurationException.php
│ │ │ │ ├── BadDecryptionException.php
│ │ │ │ ├── BadModeException.php
│ │ │ │ ├── ConnectionClosedException.php
│ │ │ │ ├── FileNotFoundException.php
│ │ │ │ ├── InconsistentSetupException.php
│ │ │ │ ├── InsufficientSetupException.php
│ │ │ │ ├── InvalidPacketLengthException.php
│ │ │ │ ├── NoKeyLoadedException.php
│ │ │ │ ├── NoSupportedAlgorithmsException.php
│ │ │ │ ├── TimeoutException.php
│ │ │ │ ├── UnableToConnectException.php
│ │ │ │ ├── UnsupportedAlgorithmException.php
│ │ │ │ ├── UnsupportedCurveException.php
│ │ │ │ ├── UnsupportedFormatException.php
│ │ │ │ └── UnsupportedOperationException.php
│ │ │ ├── File/
│ │ │ │ ├── ANSI.php
│ │ │ │ ├── ASN1/
│ │ │ │ │ ├── Element.php
│ │ │ │ │ └── Maps/
│ │ │ │ │ ├── AccessDescription.php
│ │ │ │ │ ├── AdministrationDomainName.php
│ │ │ │ │ ├── AlgorithmIdentifier.php
│ │ │ │ │ ├── AnotherName.php
│ │ │ │ │ ├── Attribute.php
│ │ │ │ │ ├── AttributeType.php
│ │ │ │ │ ├── AttributeTypeAndValue.php
│ │ │ │ │ ├── AttributeValue.php
│ │ │ │ │ ├── Attributes.php
│ │ │ │ │ ├── AuthorityInfoAccessSyntax.php
│ │ │ │ │ ├── AuthorityKeyIdentifier.php
│ │ │ │ │ ├── BaseDistance.php
│ │ │ │ │ ├── BasicConstraints.php
│ │ │ │ │ ├── BuiltInDomainDefinedAttribute.php
│ │ │ │ │ ├── BuiltInDomainDefinedAttributes.php
│ │ │ │ │ ├── BuiltInStandardAttributes.php
│ │ │ │ │ ├── CPSuri.php
│ │ │ │ │ ├── CRLDistributionPoints.php
│ │ │ │ │ ├── CRLNumber.php
│ │ │ │ │ ├── CRLReason.php
│ │ │ │ │ ├── CertPolicyId.php
│ │ │ │ │ ├── Certificate.php
│ │ │ │ │ ├── CertificateIssuer.php
│ │ │ │ │ ├── CertificateList.php
│ │ │ │ │ ├── CertificatePolicies.php
│ │ │ │ │ ├── CertificateSerialNumber.php
│ │ │ │ │ ├── CertificationRequest.php
│ │ │ │ │ ├── CertificationRequestInfo.php
│ │ │ │ │ ├── Characteristic_two.php
│ │ │ │ │ ├── CountryName.php
│ │ │ │ │ ├── Curve.php
│ │ │ │ │ ├── DHParameter.php
│ │ │ │ │ ├── DSAParams.php
│ │ │ │ │ ├── DSAPrivateKey.php
│ │ │ │ │ ├── DSAPublicKey.php
│ │ │ │ │ ├── DigestInfo.php
│ │ │ │ │ ├── DirectoryString.php
│ │ │ │ │ ├── DisplayText.php
│ │ │ │ │ ├── DistributionPoint.php
│ │ │ │ │ ├── DistributionPointName.php
│ │ │ │ │ ├── DssSigValue.php
│ │ │ │ │ ├── ECParameters.php
│ │ │ │ │ ├── ECPoint.php
│ │ │ │ │ ├── ECPrivateKey.php
│ │ │ │ │ ├── EDIPartyName.php
│ │ │ │ │ ├── EcdsaSigValue.php
│ │ │ │ │ ├── EncryptedData.php
│ │ │ │ │ ├── EncryptedPrivateKeyInfo.php
│ │ │ │ │ ├── ExtKeyUsageSyntax.php
│ │ │ │ │ ├── Extension.php
│ │ │ │ │ ├── ExtensionAttribute.php
│ │ │ │ │ ├── ExtensionAttributes.php
│ │ │ │ │ ├── Extensions.php
│ │ │ │ │ ├── FieldElement.php
│ │ │ │ │ ├── FieldID.php
│ │ │ │ │ ├── GeneralName.php
│ │ │ │ │ ├── GeneralNames.php
│ │ │ │ │ ├── GeneralSubtree.php
│ │ │ │ │ ├── GeneralSubtrees.php
│ │ │ │ │ ├── HashAlgorithm.php
│ │ │ │ │ ├── HoldInstructionCode.php
│ │ │ │ │ ├── InvalidityDate.php
│ │ │ │ │ ├── IssuerAltName.php
│ │ │ │ │ ├── IssuingDistributionPoint.php
│ │ │ │ │ ├── KeyIdentifier.php
│ │ │ │ │ ├── KeyPurposeId.php
│ │ │ │ │ ├── KeyUsage.php
│ │ │ │ │ ├── MaskGenAlgorithm.php
│ │ │ │ │ ├── Name.php
│ │ │ │ │ ├── NameConstraints.php
│ │ │ │ │ ├── NetworkAddress.php
│ │ │ │ │ ├── NoticeReference.php
│ │ │ │ │ ├── NumericUserIdentifier.php
│ │ │ │ │ ├── ORAddress.php
│ │ │ │ │ ├── OneAsymmetricKey.php
│ │ │ │ │ ├── OrganizationName.php
│ │ │ │ │ ├── OrganizationalUnitNames.php
│ │ │ │ │ ├── OtherPrimeInfo.php
│ │ │ │ │ ├── OtherPrimeInfos.php
│ │ │ │ │ ├── PBEParameter.php
│ │ │ │ │ ├── PBES2params.php
│ │ │ │ │ ├── PBKDF2params.php
│ │ │ │ │ ├── PBMAC1params.php
│ │ │ │ │ ├── PKCS9String.php
│ │ │ │ │ ├── Pentanomial.php
│ │ │ │ │ ├── PersonalName.php
│ │ │ │ │ ├── PolicyInformation.php
│ │ │ │ │ ├── PolicyMappings.php
│ │ │ │ │ ├── PolicyQualifierId.php
│ │ │ │ │ ├── PolicyQualifierInfo.php
│ │ │ │ │ ├── PostalAddress.php
│ │ │ │ │ ├── Prime_p.php
│ │ │ │ │ ├── PrivateDomainName.php
│ │ │ │ │ ├── PrivateKey.php
│ │ │ │ │ ├── PrivateKeyInfo.php
│ │ │ │ │ ├── PrivateKeyUsagePeriod.php
│ │ │ │ │ ├── PublicKey.php
│ │ │ │ │ ├── PublicKeyAndChallenge.php
│ │ │ │ │ ├── PublicKeyInfo.php
│ │ │ │ │ ├── RC2CBCParameter.php
│ │ │ │ │ ├── RDNSequence.php
│ │ │ │ │ ├── RSAPrivateKey.php
│ │ │ │ │ ├── RSAPublicKey.php
│ │ │ │ │ ├── RSASSA_PSS_params.php
│ │ │ │ │ ├── ReasonFlags.php
│ │ │ │ │ ├── RelativeDistinguishedName.php
│ │ │ │ │ ├── RevokedCertificate.php
│ │ │ │ │ ├── SignedPublicKeyAndChallenge.php
│ │ │ │ │ ├── SpecifiedECDomain.php
│ │ │ │ │ ├── SubjectAltName.php
│ │ │ │ │ ├── SubjectDirectoryAttributes.php
│ │ │ │ │ ├── SubjectInfoAccessSyntax.php
│ │ │ │ │ ├── SubjectPublicKeyInfo.php
│ │ │ │ │ ├── TBSCertList.php
│ │ │ │ │ ├── TBSCertificate.php
│ │ │ │ │ ├── TerminalIdentifier.php
│ │ │ │ │ ├── Time.php
│ │ │ │ │ ├── Trinomial.php
│ │ │ │ │ ├── UniqueIdentifier.php
│ │ │ │ │ ├── UserNotice.php
│ │ │ │ │ ├── Validity.php
│ │ │ │ │ ├── netscape_ca_policy_url.php
│ │ │ │ │ ├── netscape_cert_type.php
│ │ │ │ │ └── netscape_comment.php
│ │ │ │ ├── ASN1.php
│ │ │ │ └── X509.php
│ │ │ ├── Math/
│ │ │ │ ├── BigInteger/
│ │ │ │ │ └── Engines/
│ │ │ │ │ ├── BCMath/
│ │ │ │ │ │ ├── Base.php
│ │ │ │ │ │ ├── BuiltIn.php
│ │ │ │ │ │ ├── DefaultEngine.php
│ │ │ │ │ │ ├── OpenSSL.php
│ │ │ │ │ │ └── Reductions/
│ │ │ │ │ │ ├── Barrett.php
│ │ │ │ │ │ └── EvalBarrett.php
│ │ │ │ │ ├── BCMath.php
│ │ │ │ │ ├── Engine.php
│ │ │ │ │ ├── GMP/
│ │ │ │ │ │ └── DefaultEngine.php
│ │ │ │ │ ├── GMP.php
│ │ │ │ │ ├── OpenSSL.php
│ │ │ │ │ ├── PHP/
│ │ │ │ │ │ ├── Base.php
│ │ │ │ │ │ ├── DefaultEngine.php
│ │ │ │ │ │ ├── Montgomery.php
│ │ │ │ │ │ ├── OpenSSL.php
│ │ │ │ │ │ └── Reductions/
│ │ │ │ │ │ ├── Barrett.php
│ │ │ │ │ │ ├── Classic.php
│ │ │ │ │ │ ├── EvalBarrett.php
│ │ │ │ │ │ ├── Montgomery.php
│ │ │ │ │ │ ├── MontgomeryMult.php
│ │ │ │ │ │ └── PowerOfTwo.php
│ │ │ │ │ ├── PHP.php
│ │ │ │ │ ├── PHP32.php
│ │ │ │ │ └── PHP64.php
│ │ │ │ ├── BigInteger.php
│ │ │ │ ├── BinaryField/
│ │ │ │ │ └── Integer.php
│ │ │ │ ├── BinaryField.php
│ │ │ │ ├── Common/
│ │ │ │ │ ├── FiniteField/
│ │ │ │ │ │ └── Integer.php
│ │ │ │ │ └── FiniteField.php
│ │ │ │ ├── PrimeField/
│ │ │ │ │ └── Integer.php
│ │ │ │ └── PrimeField.php
│ │ │ ├── Net/
│ │ │ │ ├── SCP.php
│ │ │ │ ├── SFTP/
│ │ │ │ │ └── Stream.php
│ │ │ │ ├── SFTP.php
│ │ │ │ └── SSH2.php
│ │ │ ├── System/
│ │ │ │ └── SSH/
│ │ │ │ ├── Agent/
│ │ │ │ │ └── Identity.php
│ │ │ │ ├── Agent.php
│ │ │ │ └── Common/
│ │ │ │ └── Traits/
│ │ │ │ └── ReadBytes.php
│ │ │ ├── bootstrap.php
│ │ │ └── openssl.cnf
│ │ ├── psr/
│ │ │ ├── cache/
│ │ │ │ ├── CHANGELOG.md
│ │ │ │ ├── LICENSE.txt
│ │ │ │ ├── README.md
│ │ │ │ ├── composer.json
│ │ │ │ └── src/
│ │ │ │ ├── CacheException.php
│ │ │ │ ├── CacheItemInterface.php
│ │ │ │ ├── CacheItemPoolInterface.php
│ │ │ │ └── InvalidArgumentException.php
│ │ │ ├── http-client/
│ │ │ │ ├── CHANGELOG.md
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── composer.json
│ │ │ │ └── src/
│ │ │ │ ├── ClientExceptionInterface.php
│ │ │ │ ├── ClientInterface.php
│ │ │ │ ├── NetworkExceptionInterface.php
│ │ │ │ └── RequestExceptionInterface.php
│ │ │ ├── http-factory/
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── composer.json
│ │ │ │ └── src/
│ │ │ │ ├── RequestFactoryInterface.php
│ │ │ │ ├── ResponseFactoryInterface.php
│ │ │ │ ├── ServerRequestFactoryInterface.php
│ │ │ │ ├── StreamFactoryInterface.php
│ │ │ │ ├── UploadedFileFactoryInterface.php
│ │ │ │ └── UriFactoryInterface.php
│ │ │ ├── http-message/
│ │ │ │ ├── CHANGELOG.md
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── composer.json
│ │ │ │ ├── docs/
│ │ │ │ │ ├── PSR7-Interfaces.md
│ │ │ │ │ └── PSR7-Usage.md
│ │ │ │ └── src/
│ │ │ │ ├── MessageInterface.php
│ │ │ │ ├── RequestInterface.php
│ │ │ │ ├── ResponseInterface.php
│ │ │ │ ├── ServerRequestInterface.php
│ │ │ │ ├── StreamInterface.php
│ │ │ │ ├── UploadedFileInterface.php
│ │ │ │ └── UriInterface.php
│ │ │ └── log/
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src/
│ │ │ ├── AbstractLogger.php
│ │ │ ├── InvalidArgumentException.php
│ │ │ ├── LogLevel.php
│ │ │ ├── LoggerAwareInterface.php
│ │ │ ├── LoggerAwareTrait.php
│ │ │ ├── LoggerInterface.php
│ │ │ ├── LoggerTrait.php
│ │ │ └── NullLogger.php
│ │ ├── ralouphie/
│ │ │ └── getallheaders/
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src/
│ │ │ └── getallheaders.php
│ │ ├── ramsey/
│ │ │ ├── collection/
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── SECURITY.md
│ │ │ │ ├── composer.json
│ │ │ │ └── src/
│ │ │ │ ├── AbstractArray.php
│ │ │ │ ├── AbstractCollection.php
│ │ │ │ ├── AbstractSet.php
│ │ │ │ ├── ArrayInterface.php
│ │ │ │ ├── Collection.php
│ │ │ │ ├── CollectionInterface.php
│ │ │ │ ├── DoubleEndedQueue.php
│ │ │ │ ├── DoubleEndedQueueInterface.php
│ │ │ │ ├── Exception/
│ │ │ │ │ ├── CollectionException.php
│ │ │ │ │ ├── CollectionMismatchException.php
│ │ │ │ │ ├── InvalidArgumentException.php
│ │ │ │ │ ├── InvalidPropertyOrMethod.php
│ │ │ │ │ ├── NoSuchElementException.php
│ │ │ │ │ ├── OutOfBoundsException.php
│ │ │ │ │ └── UnsupportedOperationException.php
│ │ │ │ ├── GenericArray.php
│ │ │ │ ├── Map/
│ │ │ │ │ ├── AbstractMap.php
│ │ │ │ │ ├── AbstractTypedMap.php
│ │ │ │ │ ├── AssociativeArrayMap.php
│ │ │ │ │ ├── MapInterface.php
│ │ │ │ │ ├── NamedParameterMap.php
│ │ │ │ │ ├── TypedMap.php
│ │ │ │ │ └── TypedMapInterface.php
│ │ │ │ ├── Queue.php
│ │ │ │ ├── QueueInterface.php
│ │ │ │ ├── Set.php
│ │ │ │ ├── Sort.php
│ │ │ │ └── Tool/
│ │ │ │ ├── TypeTrait.php
│ │ │ │ ├── ValueExtractorTrait.php
│ │ │ │ └── ValueToStringTrait.php
│ │ │ └── uuid/
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src/
│ │ │ ├── BinaryUtils.php
│ │ │ ├── Builder/
│ │ │ │ ├── BuilderCollection.php
│ │ │ │ ├── DefaultUuidBuilder.php
│ │ │ │ ├── DegradedUuidBuilder.php
│ │ │ │ ├── FallbackBuilder.php
│ │ │ │ └── UuidBuilderInterface.php
│ │ │ ├── Codec/
│ │ │ │ ├── CodecInterface.php
│ │ │ │ ├── GuidStringCodec.php
│ │ │ │ ├── OrderedTimeCodec.php
│ │ │ │ ├── StringCodec.php
│ │ │ │ ├── TimestampFirstCombCodec.php
│ │ │ │ └── TimestampLastCombCodec.php
│ │ │ ├── Converter/
│ │ │ │ ├── Number/
│ │ │ │ │ ├── BigNumberConverter.php
│ │ │ │ │ ├── DegradedNumberConverter.php
│ │ │ │ │ └── GenericNumberConverter.php
│ │ │ │ ├── NumberConverterInterface.php
│ │ │ │ ├── Time/
│ │ │ │ │ ├── BigNumberTimeConverter.php
│ │ │ │ │ ├── DegradedTimeConverter.php
│ │ │ │ │ ├── GenericTimeConverter.php
│ │ │ │ │ ├── PhpTimeConverter.php
│ │ │ │ │ └── UnixTimeConverter.php
│ │ │ │ └── TimeConverterInterface.php
│ │ │ ├── DegradedUuid.php
│ │ │ ├── DeprecatedUuidInterface.php
│ │ │ ├── DeprecatedUuidMethodsTrait.php
│ │ │ ├── Exception/
│ │ │ │ ├── BuilderNotFoundException.php
│ │ │ │ ├── DateTimeException.php
│ │ │ │ ├── DceSecurityException.php
│ │ │ │ ├── InvalidArgumentException.php
│ │ │ │ ├── InvalidBytesException.php
│ │ │ │ ├── InvalidUuidStringException.php
│ │ │ │ ├── NameException.php
│ │ │ │ ├── NodeException.php
│ │ │ │ ├── RandomSourceException.php
│ │ │ │ ├── TimeSourceException.php
│ │ │ │ ├── UnableToBuildUuidException.php
│ │ │ │ ├── UnsupportedOperationException.php
│ │ │ │ └── UuidExceptionInterface.php
│ │ │ ├── FeatureSet.php
│ │ │ ├── Fields/
│ │ │ │ ├── FieldsInterface.php
│ │ │ │ └── SerializableFieldsTrait.php
│ │ │ ├── Generator/
│ │ │ │ ├── CombGenerator.php
│ │ │ │ ├── DceSecurityGenerator.php
│ │ │ │ ├── DceSecurityGeneratorInterface.php
│ │ │ │ ├── DefaultNameGenerator.php
│ │ │ │ ├── DefaultTimeGenerator.php
│ │ │ │ ├── NameGeneratorFactory.php
│ │ │ │ ├── NameGeneratorInterface.php
│ │ │ │ ├── PeclUuidNameGenerator.php
│ │ │ │ ├── PeclUuidRandomGenerator.php
│ │ │ │ ├── PeclUuidTimeGenerator.php
│ │ │ │ ├── RandomBytesGenerator.php
│ │ │ │ ├── RandomGeneratorFactory.php
│ │ │ │ ├── RandomGeneratorInterface.php
│ │ │ │ ├── RandomLibAdapter.php
│ │ │ │ ├── TimeGeneratorFactory.php
│ │ │ │ ├── TimeGeneratorInterface.php
│ │ │ │ └── UnixTimeGenerator.php
│ │ │ ├── Guid/
│ │ │ │ ├── Fields.php
│ │ │ │ ├── Guid.php
│ │ │ │ └── GuidBuilder.php
│ │ │ ├── Lazy/
│ │ │ │ └── LazyUuidFromString.php
│ │ │ ├── Math/
│ │ │ │ ├── BrickMathCalculator.php
│ │ │ │ ├── CalculatorInterface.php
│ │ │ │ └── RoundingMode.php
│ │ │ ├── Nonstandard/
│ │ │ │ ├── Fields.php
│ │ │ │ ├── Uuid.php
│ │ │ │ ├── UuidBuilder.php
│ │ │ │ └── UuidV6.php
│ │ │ ├── Provider/
│ │ │ │ ├── Dce/
│ │ │ │ │ └── SystemDceSecurityProvider.php
│ │ │ │ ├── DceSecurityProviderInterface.php
│ │ │ │ ├── Node/
│ │ │ │ │ ├── FallbackNodeProvider.php
│ │ │ │ │ ├── NodeProviderCollection.php
│ │ │ │ │ ├── RandomNodeProvider.php
│ │ │ │ │ ├── StaticNodeProvider.php
│ │ │ │ │ └── SystemNodeProvider.php
│ │ │ │ ├── NodeProviderInterface.php
│ │ │ │ ├── Time/
│ │ │ │ │ ├── FixedTimeProvider.php
│ │ │ │ │ └── SystemTimeProvider.php
│ │ │ │ └── TimeProviderInterface.php
│ │ │ ├── Rfc4122/
│ │ │ │ ├── Fields.php
│ │ │ │ ├── FieldsInterface.php
│ │ │ │ ├── MaxTrait.php
│ │ │ │ ├── MaxUuid.php
│ │ │ │ ├── NilTrait.php
│ │ │ │ ├── NilUuid.php
│ │ │ │ ├── TimeTrait.php
│ │ │ │ ├── UuidBuilder.php
│ │ │ │ ├── UuidInterface.php
│ │ │ │ ├── UuidV1.php
│ │ │ │ ├── UuidV2.php
│ │ │ │ ├── UuidV3.php
│ │ │ │ ├── UuidV4.php
│ │ │ │ ├── UuidV5.php
│ │ │ │ ├── UuidV6.php
│ │ │ │ ├── UuidV7.php
│ │ │ │ ├── UuidV8.php
│ │ │ │ ├── Validator.php
│ │ │ │ ├── VariantTrait.php
│ │ │ │ └── VersionTrait.php
│ │ │ ├── Type/
│ │ │ │ ├── Decimal.php
│ │ │ │ ├── Hexadecimal.php
│ │ │ │ ├── Integer.php
│ │ │ │ ├── NumberInterface.php
│ │ │ │ ├── Time.php
│ │ │ │ └── TypeInterface.php
│ │ │ ├── Uuid.php
│ │ │ ├── UuidFactory.php
│ │ │ ├── UuidFactoryInterface.php
│ │ │ ├── UuidInterface.php
│ │ │ ├── Validator/
│ │ │ │ ├── GenericValidator.php
│ │ │ │ └── ValidatorInterface.php
│ │ │ └── functions.php
│ │ ├── rize/
│ │ │ └── uri-template/
│ │ │ ├── .php-cs-fixer.dist.php
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ ├── phpstan.neon
│ │ │ ├── phpunit.xml
│ │ │ ├── src/
│ │ │ │ └── Rize/
│ │ │ │ ├── UriTemplate/
│ │ │ │ │ ├── Node/
│ │ │ │ │ │ ├── Abstraction.php
│ │ │ │ │ │ ├── Expression.php
│ │ │ │ │ │ ├── Literal.php
│ │ │ │ │ │ └── Variable.php
│ │ │ │ │ ├── Operator/
│ │ │ │ │ │ ├── Abstraction.php
│ │ │ │ │ │ ├── Named.php
│ │ │ │ │ │ └── UnNamed.php
│ │ │ │ │ ├── Parser.php
│ │ │ │ │ └── UriTemplate.php
│ │ │ │ └── UriTemplate.php
│ │ │ └── tests/
│ │ │ ├── Rize/
│ │ │ │ ├── Uri/
│ │ │ │ │ └── Node/
│ │ │ │ │ └── ParserTest.php
│ │ │ │ └── UriTemplateTest.php
│ │ │ └── fixtures/
│ │ │ ├── README.md
│ │ │ ├── extended-tests.json
│ │ │ ├── json2xml.xslt
│ │ │ ├── negative-tests.json
│ │ │ ├── spec-examples-by-section.json
│ │ │ ├── spec-examples.json
│ │ │ └── transform-json-tests.xslt
│ │ └── symfony/
│ │ └── deprecation-contracts/
│ │ ├── CHANGELOG.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── composer.json
│ │ └── function.php
│ ├── classes/
│ │ ├── batch/
│ │ │ ├── class-batch-task-manager.php
│ │ │ ├── class-batch-task.php
│ │ │ ├── class-migration.php
│ │ │ └── interface-batch.php
│ │ ├── class-addons.php
│ │ ├── class-ajax.php
│ │ ├── class-api.php
│ │ ├── class-bootstrap.php
│ │ ├── class-compatibility.php
│ │ ├── class-db.php
│ │ ├── class-dynamic-image-support.php
│ │ ├── class-errors.php
│ │ ├── class-google-app-engine.php
│ │ ├── class-gs-client.php
│ │ ├── class-gs-stream-wrapper.php
│ │ ├── class-helper.php
│ │ ├── class-logger.php
│ │ ├── class-migrator.php
│ │ ├── class-module.php
│ │ ├── class-settings.php
│ │ ├── class-status.php
│ │ ├── class-sync-non-media.php
│ │ ├── class-upgrader.php
│ │ ├── class-utility.php
│ │ ├── compatibility/
│ │ │ ├── ewww.php
│ │ │ ├── imagify.php
│ │ │ ├── js/
│ │ │ │ └── shortpixel.js
│ │ │ ├── learn-dash.php
│ │ │ ├── shortpixel.php
│ │ │ ├── the-events-calendar.php
│ │ │ ├── wp-smush.php
│ │ │ └── wpbakery-page-builder.php
│ │ ├── exception-fatal.php
│ │ ├── exception-unprocessable.php
│ │ ├── status/
│ │ │ ├── class-info-google_cloud.php
│ │ │ ├── class-info-stateless.php
│ │ │ ├── class-info.php
│ │ │ └── class-migrations.php
│ │ ├── sync/
│ │ │ ├── class-background-sync.php
│ │ │ ├── class-file-sync.php
│ │ │ ├── class-helper-window.php
│ │ │ ├── class-image-sync.php
│ │ │ ├── class-library-sync.php
│ │ │ ├── class-non-library-sync.php
│ │ │ └── interface-sync.php
│ │ └── trait-singleton.php
│ ├── cli/
│ │ ├── class-sm-cli-command.php
│ │ ├── class-sm-cli-process.php
│ │ ├── class-sm-cli-scaffold.php
│ │ ├── class-sm-cli-sync.php
│ │ ├── class-sm-cli-upgrade.php
│ │ └── class-sm-cli.php
│ ├── includes/
│ │ ├── class-settings.php
│ │ └── class-utility.php
│ ├── meta-box-tabs/
│ │ ├── CHANGELOG.md
│ │ ├── meta-box-tabs.php
│ │ ├── tabs.css
│ │ └── tabs.js
│ └── ns-vendor/
│ └── classes/
│ ├── .gitkeep
│ └── deliciousbrains/
│ └── wp-background-processing/
│ └── classes/
│ ├── wp-async-request.php
│ └── wp-background-process.php
├── readme.md
├── readme.txt
├── static/
│ ├── data/
│ │ └── addons.php
│ ├── migrations/
│ │ ├── 20240219175240.php
│ │ └── 20240423174109.php
│ ├── scripts/
│ │ ├── error-notice.js
│ │ ├── i18n/
│ │ │ ├── af.js
│ │ │ ├── ar.js
│ │ │ ├── az.js
│ │ │ ├── bg.js
│ │ │ ├── bn.js
│ │ │ ├── bs.js
│ │ │ ├── ca.js
│ │ │ ├── cs.js
│ │ │ ├── da.js
│ │ │ ├── de.js
│ │ │ ├── dsb.js
│ │ │ ├── el.js
│ │ │ ├── en.js
│ │ │ ├── es.js
│ │ │ ├── et.js
│ │ │ ├── eu.js
│ │ │ ├── fa.js
│ │ │ ├── fi.js
│ │ │ ├── fr.js
│ │ │ ├── gl.js
│ │ │ ├── he.js
│ │ │ ├── hi.js
│ │ │ ├── hr.js
│ │ │ ├── hsb.js
│ │ │ ├── hu.js
│ │ │ ├── hy.js
│ │ │ ├── id.js
│ │ │ ├── is.js
│ │ │ ├── it.js
│ │ │ ├── ja.js
│ │ │ ├── ka.js
│ │ │ ├── km.js
│ │ │ ├── ko.js
│ │ │ ├── lt.js
│ │ │ ├── lv.js
│ │ │ ├── mk.js
│ │ │ ├── ms.js
│ │ │ ├── nb.js
│ │ │ ├── ne.js
│ │ │ ├── nl.js
│ │ │ ├── pl.js
│ │ │ ├── ps.js
│ │ │ ├── pt-BR.js
│ │ │ ├── pt.js
│ │ │ ├── ro.js
│ │ │ ├── ru.js
│ │ │ ├── sk.js
│ │ │ ├── sl.js
│ │ │ ├── sq.js
│ │ │ ├── sr-Cyrl.js
│ │ │ ├── sr.js
│ │ │ ├── sv.js
│ │ │ ├── th.js
│ │ │ ├── tk.js
│ │ │ ├── tr.js
│ │ │ ├── uk.js
│ │ │ ├── vi.js
│ │ │ ├── zh-CN.js
│ │ │ └── zh-TW.js
│ │ ├── jquery-ui/
│ │ │ ├── jquery.ui.progressbar.min.1.7.2.js
│ │ │ └── redmond/
│ │ │ └── jquery-ui-1.7.2.custom.css
│ │ ├── wp-stateless-batch.js
│ │ ├── wp-stateless-settings.js
│ │ ├── wp-stateless-uploads.js
│ │ └── wp-stateless.js
│ ├── styles/
│ │ ├── error-notice.css
│ │ ├── wp-stateless-addons.css
│ │ ├── wp-stateless-settings.css
│ │ ├── wp-stateless-setup-wizard.css
│ │ ├── wp-stateless-status.css
│ │ └── wp-stateless.css
│ ├── views/
│ │ ├── .gitkeep
│ │ ├── addons-tab.php
│ │ ├── compatibility-tab.php
│ │ ├── error-notice.php
│ │ ├── processing_interface.php
│ │ ├── settings-sections/
│ │ │ ├── file-url.php
│ │ │ ├── general.php
│ │ │ ├── google-cloud-storage.php
│ │ │ └── network.php
│ │ ├── settings-tab.php
│ │ ├── settings_interface.php
│ │ ├── setup_wizard_interface.php
│ │ └── status-sections/
│ │ ├── info.php
│ │ └── migrations.php
│ └── wiki/
│ └── Media-Object.md
├── vendor/
│ ├── autoload.php
│ ├── ccampbell/
│ │ └── chromephp/
│ │ ├── ChromePhp.php
│ │ ├── README.md
│ │ └── composer.json
│ ├── composer/
│ │ ├── ClassLoader.php
│ │ ├── InstalledVersions.php
│ │ ├── LICENSE
│ │ ├── autoload_classmap.php
│ │ ├── autoload_namespaces.php
│ │ ├── autoload_psr4.php
│ │ ├── autoload_real.php
│ │ ├── autoload_static.php
│ │ ├── installed.json
│ │ ├── installed.php
│ │ ├── installers/
│ │ │ ├── .github/
│ │ │ │ └── workflows/
│ │ │ │ ├── continuous-integration.yml
│ │ │ │ ├── lint.yml
│ │ │ │ └── phpstan.yml
│ │ │ ├── LICENSE
│ │ │ ├── composer.json
│ │ │ └── src/
│ │ │ ├── Composer/
│ │ │ │ └── Installers/
│ │ │ │ ├── AglInstaller.php
│ │ │ │ ├── AkauntingInstaller.php
│ │ │ │ ├── AnnotateCmsInstaller.php
│ │ │ │ ├── AsgardInstaller.php
│ │ │ │ ├── AttogramInstaller.php
│ │ │ │ ├── BaseInstaller.php
│ │ │ │ ├── BitrixInstaller.php
│ │ │ │ ├── BonefishInstaller.php
│ │ │ │ ├── BotbleInstaller.php
│ │ │ │ ├── CakePHPInstaller.php
│ │ │ │ ├── ChefInstaller.php
│ │ │ │ ├── CiviCrmInstaller.php
│ │ │ │ ├── ClanCatsFrameworkInstaller.php
│ │ │ │ ├── CockpitInstaller.php
│ │ │ │ ├── CodeIgniterInstaller.php
│ │ │ │ ├── Concrete5Installer.php
│ │ │ │ ├── ConcreteCMSInstaller.php
│ │ │ │ ├── CroogoInstaller.php
│ │ │ │ ├── DecibelInstaller.php
│ │ │ │ ├── DframeInstaller.php
│ │ │ │ ├── DokuWikiInstaller.php
│ │ │ │ ├── DolibarrInstaller.php
│ │ │ │ ├── DrupalInstaller.php
│ │ │ │ ├── ElggInstaller.php
│ │ │ │ ├── EliasisInstaller.php
│ │ │ │ ├── ExpressionEngineInstaller.php
│ │ │ │ ├── EzPlatformInstaller.php
│ │ │ │ ├── ForkCMSInstaller.php
│ │ │ │ ├── FuelInstaller.php
│ │ │ │ ├── FuelphpInstaller.php
│ │ │ │ ├── GravInstaller.php
│ │ │ │ ├── HuradInstaller.php
│ │ │ │ ├── ImageCMSInstaller.php
│ │ │ │ ├── Installer.php
│ │ │ │ ├── ItopInstaller.php
│ │ │ │ ├── KanboardInstaller.php
│ │ │ │ ├── KnownInstaller.php
│ │ │ │ ├── KodiCMSInstaller.php
│ │ │ │ ├── KohanaInstaller.php
│ │ │ │ ├── LanManagementSystemInstaller.php
│ │ │ │ ├── LaravelInstaller.php
│ │ │ │ ├── LavaLiteInstaller.php
│ │ │ │ ├── LithiumInstaller.php
│ │ │ │ ├── MODULEWorkInstaller.php
│ │ │ │ ├── MODXEvoInstaller.php
│ │ │ │ ├── MagentoInstaller.php
│ │ │ │ ├── MajimaInstaller.php
│ │ │ │ ├── MakoInstaller.php
│ │ │ │ ├── MantisBTInstaller.php
│ │ │ │ ├── MatomoInstaller.php
│ │ │ │ ├── MauticInstaller.php
│ │ │ │ ├── MayaInstaller.php
│ │ │ │ ├── MediaWikiInstaller.php
│ │ │ │ ├── MiaoxingInstaller.php
│ │ │ │ ├── MicroweberInstaller.php
│ │ │ │ ├── ModxInstaller.php
│ │ │ │ ├── MoodleInstaller.php
│ │ │ │ ├── OctoberInstaller.php
│ │ │ │ ├── OntoWikiInstaller.php
│ │ │ │ ├── OsclassInstaller.php
│ │ │ │ ├── OxidInstaller.php
│ │ │ │ ├── PPIInstaller.php
│ │ │ │ ├── PantheonInstaller.php
│ │ │ │ ├── PhiftyInstaller.php
│ │ │ │ ├── PhpBBInstaller.php
│ │ │ │ ├── PiwikInstaller.php
│ │ │ │ ├── PlentymarketsInstaller.php
│ │ │ │ ├── Plugin.php
│ │ │ │ ├── PortoInstaller.php
│ │ │ │ ├── PrestashopInstaller.php
│ │ │ │ ├── ProcessWireInstaller.php
│ │ │ │ ├── PuppetInstaller.php
│ │ │ │ ├── PxcmsInstaller.php
│ │ │ │ ├── RadPHPInstaller.php
│ │ │ │ ├── ReIndexInstaller.php
│ │ │ │ ├── Redaxo5Installer.php
│ │ │ │ ├── RedaxoInstaller.php
│ │ │ │ ├── RoundcubeInstaller.php
│ │ │ │ ├── SMFInstaller.php
│ │ │ │ ├── ShopwareInstaller.php
│ │ │ │ ├── SilverStripeInstaller.php
│ │ │ │ ├── SiteDirectInstaller.php
│ │ │ │ ├── StarbugInstaller.php
│ │ │ │ ├── SyDESInstaller.php
│ │ │ │ ├── SyliusInstaller.php
│ │ │ │ ├── TaoInstaller.php
│ │ │ │ ├── TastyIgniterInstaller.php
│ │ │ │ ├── TheliaInstaller.php
│ │ │ │ ├── TuskInstaller.php
│ │ │ │ ├── UserFrostingInstaller.php
│ │ │ │ ├── VanillaInstaller.php
│ │ │ │ ├── VgmcpInstaller.php
│ │ │ │ ├── WHMCSInstaller.php
│ │ │ │ ├── WinterInstaller.php
│ │ │ │ ├── WolfCMSInstaller.php
│ │ │ │ ├── WordPressInstaller.php
│ │ │ │ ├── YawikInstaller.php
│ │ │ │ ├── ZendInstaller.php
│ │ │ │ └── ZikulaInstaller.php
│ │ │ └── bootstrap.php
│ │ └── platform_check.php
│ ├── firebase/
│ │ └── php-jwt/
│ │ ├── CHANGELOG.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── composer.json
│ │ └── src/
│ │ ├── BeforeValidException.php
│ │ ├── CachedKeySet.php
│ │ ├── ExpiredException.php
│ │ ├── JWK.php
│ │ ├── JWT.php
│ │ ├── JWTExceptionWithPayloadInterface.php
│ │ ├── Key.php
│ │ └── SignatureInvalidException.php
│ ├── udx/
│ │ ├── lib-ud-api-client/
│ │ │ ├── .gitignore
│ │ │ ├── .scrutinizer.yml
│ │ │ ├── changes.md
│ │ │ ├── composer.json
│ │ │ ├── gruntfile.js
│ │ │ ├── lib/
│ │ │ │ └── classes/
│ │ │ │ ├── class-admin.php
│ │ │ │ ├── class-api.php
│ │ │ │ ├── class-bootstrap.php
│ │ │ │ ├── class-licenses-table.php
│ │ │ │ ├── class-manager.php
│ │ │ │ ├── class-more-products-table.php
│ │ │ │ ├── class-scaffold.php
│ │ │ │ ├── class-ui.php
│ │ │ │ ├── class-update-checker.php
│ │ │ │ └── class-utility.php
│ │ │ ├── package.json
│ │ │ ├── readme.md
│ │ │ └── static/
│ │ │ ├── css/
│ │ │ │ ├── admin.css
│ │ │ │ └── src/
│ │ │ │ └── admin.less
│ │ │ └── templates/
│ │ │ ├── admin-notice.php
│ │ │ ├── screen-manage-plugin.php
│ │ │ ├── screen-manage-theme.php
│ │ │ └── screen-more.php
│ │ └── lib-wp-bootstrap/
│ │ ├── .gitignore
│ │ ├── changes.md
│ │ ├── composer.json
│ │ ├── lib/
│ │ │ └── classes/
│ │ │ ├── class-bootstrap-plugin.php
│ │ │ ├── class-bootstrap-theme.php
│ │ │ ├── class-bootstrap.php
│ │ │ ├── class-dashboard.php
│ │ │ ├── class-errors.php
│ │ │ ├── class-scaffold.php
│ │ │ ├── class-tgm-bulk-installer.php
│ │ │ ├── class-tgm-list-table.php
│ │ │ ├── class-tgm-plugin-activation.php
│ │ │ └── class-utility.php
│ │ ├── readme.md
│ │ └── static/
│ │ └── scripts/
│ │ └── ud-dismiss.js
│ └── wpmetabox/
│ └── meta-box/
│ ├── css/
│ │ ├── autocomplete.css
│ │ ├── background.css
│ │ ├── button-group.css
│ │ ├── color.css
│ │ ├── date.css
│ │ ├── divider.css
│ │ ├── fieldset-text.css
│ │ ├── file-input.css
│ │ ├── file.css
│ │ ├── fontawesome/
│ │ │ └── icons.json
│ │ ├── heading.css
│ │ ├── icon.css
│ │ ├── image-select.css
│ │ ├── image.css
│ │ ├── input-list.css
│ │ ├── input.css
│ │ ├── jqueryui/
│ │ │ ├── core.css
│ │ │ ├── datepicker.css
│ │ │ ├── slider.css
│ │ │ └── theme.css
│ │ ├── key-value.css
│ │ ├── map.css
│ │ ├── media.css
│ │ ├── modal.css
│ │ ├── oembed.css
│ │ ├── osm-frontend.css
│ │ ├── osm.css
│ │ ├── password.css
│ │ ├── range.css
│ │ ├── select-advanced.css
│ │ ├── select-tree.css
│ │ ├── select.css
│ │ ├── select2/
│ │ │ └── select2.css
│ │ ├── slider.css
│ │ ├── style-rtl.css
│ │ ├── style.css
│ │ ├── switch.css
│ │ ├── text-list.css
│ │ ├── upload.css
│ │ ├── video.css
│ │ └── wysiwyg.css
│ ├── inc/
│ │ ├── autoloader.php
│ │ ├── clone.php
│ │ ├── core.php
│ │ ├── field-registry.php
│ │ ├── field.php
│ │ ├── fields/
│ │ │ ├── autocomplete.php
│ │ │ ├── background.php
│ │ │ ├── button-group.php
│ │ │ ├── button.php
│ │ │ ├── checkbox-list.php
│ │ │ ├── checkbox.php
│ │ │ ├── choice.php
│ │ │ ├── color.php
│ │ │ ├── custom-html.php
│ │ │ ├── date.php
│ │ │ ├── datetime.php
│ │ │ ├── divider.php
│ │ │ ├── fieldset-text.php
│ │ │ ├── file-input.php
│ │ │ ├── file-upload.php
│ │ │ ├── file.php
│ │ │ ├── heading.php
│ │ │ ├── icon.php
│ │ │ ├── image-advanced.php
│ │ │ ├── image-select.php
│ │ │ ├── image-upload.php
│ │ │ ├── image.php
│ │ │ ├── input-list.php
│ │ │ ├── input.php
│ │ │ ├── key-value.php
│ │ │ ├── map.php
│ │ │ ├── media.php
│ │ │ ├── multiple-values.php
│ │ │ ├── number.php
│ │ │ ├── object-choice.php
│ │ │ ├── oembed.php
│ │ │ ├── osm.php
│ │ │ ├── password.php
│ │ │ ├── post.php
│ │ │ ├── radio.php
│ │ │ ├── range.php
│ │ │ ├── select-advanced.php
│ │ │ ├── select-tree.php
│ │ │ ├── select.php
│ │ │ ├── sidebar.php
│ │ │ ├── single-image.php
│ │ │ ├── slider.php
│ │ │ ├── switch.php
│ │ │ ├── taxonomy-advanced.php
│ │ │ ├── taxonomy.php
│ │ │ ├── text-list.php
│ │ │ ├── textarea.php
│ │ │ ├── time.php
│ │ │ ├── user.php
│ │ │ ├── video.php
│ │ │ └── wysiwyg.php
│ │ ├── functions.php
│ │ ├── helpers/
│ │ │ ├── array.php
│ │ │ ├── field.php
│ │ │ ├── string.php
│ │ │ └── value.php
│ │ ├── interfaces/
│ │ │ └── storage.php
│ │ ├── loader.php
│ │ ├── media-modal.php
│ │ ├── meta-box-registry.php
│ │ ├── meta-box.php
│ │ ├── request.php
│ │ ├── sanitizer.php
│ │ ├── shortcode.php
│ │ ├── storage-registry.php
│ │ ├── storages/
│ │ │ ├── base.php
│ │ │ └── post.php
│ │ ├── validation.php
│ │ └── walkers/
│ │ ├── base.php
│ │ ├── input-list.php
│ │ ├── select-tree.php
│ │ └── select.php
│ ├── js/
│ │ ├── autocomplete.js
│ │ ├── autosave.js
│ │ ├── button-group.js
│ │ ├── clone.js
│ │ ├── color.js
│ │ ├── date.js
│ │ ├── datetime.js
│ │ ├── file-input.js
│ │ ├── file-upload.js
│ │ ├── file.js
│ │ ├── icon.js
│ │ ├── image-advanced.js
│ │ ├── image-upload.js
│ │ ├── input-list.js
│ │ ├── jqueryui/
│ │ │ └── jquery-ui-sliderAccess.js
│ │ ├── leaflet/
│ │ │ ├── leaflet.css
│ │ │ └── leaflet.js
│ │ ├── map-frontend.js
│ │ ├── map.js
│ │ ├── media.js
│ │ ├── modal.js
│ │ ├── oembed.js
│ │ ├── osm-frontend.js
│ │ ├── osm.js
│ │ ├── password.js
│ │ ├── post.js
│ │ ├── range.js
│ │ ├── script.js
│ │ ├── select-advanced.js
│ │ ├── select-tree.js
│ │ ├── select.js
│ │ ├── select2/
│ │ │ └── i18n/
│ │ │ ├── af.js
│ │ │ ├── ar.js
│ │ │ ├── az.js
│ │ │ ├── bg.js
│ │ │ ├── bn.js
│ │ │ ├── bs.js
│ │ │ ├── ca.js
│ │ │ ├── cs.js
│ │ │ ├── da.js
│ │ │ ├── de.js
│ │ │ ├── dsb.js
│ │ │ ├── el.js
│ │ │ ├── en.js
│ │ │ ├── es.js
│ │ │ ├── et.js
│ │ │ ├── eu.js
│ │ │ ├── fa.js
│ │ │ ├── fi.js
│ │ │ ├── fr.js
│ │ │ ├── gl.js
│ │ │ ├── he.js
│ │ │ ├── hi.js
│ │ │ ├── hr.js
│ │ │ ├── hsb.js
│ │ │ ├── hu.js
│ │ │ ├── hy.js
│ │ │ ├── id.js
│ │ │ ├── is.js
│ │ │ ├── it.js
│ │ │ ├── ja.js
│ │ │ ├── ka.js
│ │ │ ├── km.js
│ │ │ ├── ko.js
│ │ │ ├── lt.js
│ │ │ ├── lv.js
│ │ │ ├── mk.js
│ │ │ ├── ms.js
│ │ │ ├── nb.js
│ │ │ ├── ne.js
│ │ │ ├── nl.js
│ │ │ ├── pl.js
│ │ │ ├── ps.js
│ │ │ ├── pt-BR.js
│ │ │ ├── pt.js
│ │ │ ├── ro.js
│ │ │ ├── ru.js
│ │ │ ├── sk.js
│ │ │ ├── sl.js
│ │ │ ├── sq.js
│ │ │ ├── sr-Cyrl.js
│ │ │ ├── sr.js
│ │ │ ├── sv.js
│ │ │ ├── th.js
│ │ │ ├── tk.js
│ │ │ ├── tr.js
│ │ │ ├── uk.js
│ │ │ ├── vi.js
│ │ │ ├── zh-CN.js
│ │ │ └── zh-TW.js
│ │ ├── slider.js
│ │ ├── taxonomy.js
│ │ ├── time.js
│ │ ├── user.js
│ │ ├── validation/
│ │ │ ├── additional-methods.js
│ │ │ ├── i18n/
│ │ │ │ ├── messages_ar.js
│ │ │ │ ├── messages_az.js
│ │ │ │ ├── messages_bg.js
│ │ │ │ ├── messages_bn_BD.js
│ │ │ │ ├── messages_ca.js
│ │ │ │ ├── messages_cs.js
│ │ │ │ ├── messages_da.js
│ │ │ │ ├── messages_de.js
│ │ │ │ ├── messages_el.js
│ │ │ │ ├── messages_es.js
│ │ │ │ ├── messages_es_AR.js
│ │ │ │ ├── messages_es_PE.js
│ │ │ │ ├── messages_et.js
│ │ │ │ ├── messages_eu.js
│ │ │ │ ├── messages_fa.js
│ │ │ │ ├── messages_fi.js
│ │ │ │ ├── messages_fr.js
│ │ │ │ ├── messages_ge.js
│ │ │ │ ├── messages_gl.js
│ │ │ │ ├── messages_he.js
│ │ │ │ ├── messages_hi.js
│ │ │ │ ├── messages_hr.js
│ │ │ │ ├── messages_hu.js
│ │ │ │ ├── messages_hy_AM.js
│ │ │ │ ├── messages_id.js
│ │ │ │ ├── messages_is.js
│ │ │ │ ├── messages_it.js
│ │ │ │ ├── messages_ja.js
│ │ │ │ ├── messages_ka.js
│ │ │ │ ├── messages_kk.js
│ │ │ │ ├── messages_ko.js
│ │ │ │ ├── messages_lt.js
│ │ │ │ ├── messages_lv.js
│ │ │ │ ├── messages_mk.js
│ │ │ │ ├── messages_my.js
│ │ │ │ ├── messages_nl.js
│ │ │ │ ├── messages_no.js
│ │ │ │ ├── messages_pl.js
│ │ │ │ ├── messages_pt_BR.js
│ │ │ │ ├── messages_pt_PT.js
│ │ │ │ ├── messages_ro.js
│ │ │ │ ├── messages_ru.js
│ │ │ │ ├── messages_sd.js
│ │ │ │ ├── messages_si.js
│ │ │ │ ├── messages_sk.js
│ │ │ │ ├── messages_sl.js
│ │ │ │ ├── messages_sr.js
│ │ │ │ ├── messages_sr_lat.js
│ │ │ │ ├── messages_sv.js
│ │ │ │ ├── messages_th.js
│ │ │ │ ├── messages_tj.js
│ │ │ │ ├── messages_tr.js
│ │ │ │ ├── messages_uk.js
│ │ │ │ ├── messages_ur.js
│ │ │ │ ├── messages_vi.js
│ │ │ │ ├── messages_zh.js
│ │ │ │ └── messages_zh_TW.js
│ │ │ ├── jquery.validate.js
│ │ │ └── validation.js
│ │ ├── video.js
│ │ └── wysiwyg.js
│ ├── meta-box.php
│ ├── readme.txt
│ ├── src/
│ │ ├── Dashboard/
│ │ │ ├── Dashboard.php
│ │ │ ├── assets/
│ │ │ │ ├── css/
│ │ │ │ │ ├── dashboard.css
│ │ │ │ │ └── dashboard.scss
│ │ │ │ └── js/
│ │ │ │ └── dashboard.js
│ │ │ └── content.php
│ │ ├── FeaturedPlugins.php
│ │ ├── Integrations/
│ │ │ ├── Block.php
│ │ │ ├── Bricks.php
│ │ │ ├── Elementor.php
│ │ │ ├── Oxygen.php
│ │ │ └── WPML.php
│ │ └── Updater/
│ │ ├── Checker.php
│ │ ├── Notification.php
│ │ ├── Option.php
│ │ └── Settings.php
│ └── vendor/
│ ├── autoload.php
│ ├── composer/
│ │ ├── ClassLoader.php
│ │ ├── InstalledVersions.php
│ │ ├── LICENSE
│ │ ├── autoload_classmap.php
│ │ ├── autoload_namespaces.php
│ │ ├── autoload_psr4.php
│ │ ├── autoload_real.php
│ │ ├── autoload_static.php
│ │ ├── installed.json
│ │ └── installed.php
│ └── wpmetabox/
│ └── support/
│ ├── Arr.php
│ └── Data.php
└── wp-stateless-media.php
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
# Enable checks for the default vendor folder
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
# Enable checks for Google API Client package
- package-ecosystem: "composer"
directory: "/lib/Google"
schedule:
interval: "weekly"
# Enable checks for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
================================================
FILE: .github/workflows/publish-release.yml
================================================
name: Publish Release
run-name: Publish Release
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g. 1.2.3a)'
required: true
version:
description: 'Release version (e.g. 1.2.3), default: latest'
required: false
prerelease:
description: 'Pre-release version (e.g. RC1, beta, etc...)'
required: false
permissions:
contents: write
jobs:
release:
uses: udx/reusable-workflows/.github/workflows/wp-gh-release-ops.yml@master
with:
tag: ${{ github.event.inputs.tag }}
version: ${{ github.event.inputs.version }}
prerelease: ${{ github.event.inputs.prerelease }}
================================================
FILE: .github/workflows/security-scan.yml
================================================
name: Security Scan
run-name: Security Scan
on:
push:
pull_request:
workflow_dispatch:
jobs:
code-scanning:
name: Code Scanning (grype)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Run Security Check
id: test
uses: anchore/scan-action@v6
with:
path: .
output-format: table
================================================
FILE: .gitignore
================================================
temp
.vscode**
node_modules
static/cache
static/codex
npm-debug.log
wp-test-config.php
/test
package-lock.json
.git
.svn
.idea
.idea/workspace.xml
.DS_Store
.dynamic
.Trashes
*.sublime-project
*.sublime-workspace
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
wp-stateless.wiki
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2018 Usability Dynamics
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: SECURITY.md
================================================
# Security Policy Overview
Thank you for using and contributing to our product. At [UDX](https://udx.io), we take the security of our products seriously and appreciate collaborative efforts to ensure the safety of our users and contributors.
## Reporting a Security Vulnerability
**Please do not report security vulnerabilities through public GitHub issues.**
If you find a security vulnerability, please [submit a vulnerability report](https://github.com/udx/wp-stateless/security/advisories/new). Provide detailed information about the vulnerability to help us understand and address the issue promptly. We kindly request that you avoid public disclosure until we've had the opportunity to analyze and resolve the reported issue.
## Responsible Disclosure
Responsible disclosure is crucial to maintaining the security of our product. We ask for your cooperation in allowing us sufficient time to investigate and address the reported vulnerability before making it public. We will keep you informed of our progress and make every effort to address the issue promptly.
## Supported Versions
Security updates are provided for the latest stable release. Please ensure that you are using a supported version before reporting a security vulnerability.
## Contact Information
For security-related matters, please contact our security team at [security@udx.io](mailto:security@udx.io). For general inquiries, feature requests, and other non-security-related discussions, please use our regular [issue tracker](https://github.com/udx/wp-stateless/issues).
Thank you for helping us ensure the security of WP-Stateless. Your contributions are greatly appreciated.
================================================
FILE: changelog.txt
================================================
== Changelog ==
= 4.4.1 - 2026-01-16 =
* COMPATIBILITY - WooCommerce Extra Product Options Compatibility replaced with [WP-Stateless – WooCommerce Extra Product Options Addon](https://wordpress.org/plugins/wp-stateless-woocommerce-extra-product-options-addon/).
* FIX - resolve critical errors with `firebase/php-jwt` library if `AUTH_SALT` WordPress constant is not set or too short.
= 4.4.0 - 2026-01-10 =
* NEW - plugin requires PHP 8.1+.
* ENHANCEMENT - updated `firebase/php-jwt` library from 6.11.1 to 7.0.2.
* ENHANCEMENT - Updated Client library for Google APIs from 2.18.3 to 2.19.0.
* ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.15 to 5.10.19.
* ENHANCEMENT - updated `Meta Box Tabs` library from 1.1.18 to 1.2.0.
* FIX - `udx/lib-wp-bootstrap` package correctly loads text domain to prevent PHP notices.
= 4.3.0 =
* ENHANCEMENT - update dependencies for Google APIs Client Library.
* COMPATIBILITY - Simple Local Avatars Compatibility replaced with [WP-Stateless - Simple Local Avatars Addon](https://wordpress.org/plugins/wp-stateless-simple-local-avatars-addon/).
= 4.2.1 =
* ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.11 to 5.10.15.
* FIX - correctly loads text domain to prevent PHP notices.
* FIX - `udx/lib-ud-api-client` package correctly loads text domain to prevent PHP notices.
= 4.2.0 =
* ENHANCEMENT - Updated Client library for Google APIs from 2.18.2 to 2.18.3.
* ENHANCEMENT - updated `firebase/php-jwt` library from 6.10.2 to 6.11.1.
* ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.1 to 5.10.11.
* DEPRECATED - Setup Assistant removed.
= 4.1.3 =
* COMPATIBILITY - PolyLang Compatibility replaced with [WP-Stateless – Polylang Pro Addon](https://wordpress.org/plugins/wp-stateless-polylang-pro-addon/).
* ENHANCEMENT - updated `wpmetabox/meta-box` library from from 5.10.1 to 5.10.7.
* ENHANCEMENT - updated `Meta Box Tabs` library from 1.1.18 to 1.2.0.
* ENHANCEMENT - updated `firebase/php-jwt` library from from 6.10.1 to 6.10.2.
* ENHANCEMENT - Updated Client library for Google APIs from 2.17.0 to 2.18.2.
* FIX - apply `Cache Control` setting to all files (previously applied only to images).
= 4.1.2 =
* ENHANCEMENT - added `REST API Endpoint` setting, which useful when WordPress dashboard and frontend website utilize different domain names.
* ENHANCEMENT - extended `Status Info` with the information to help diagnose REST API or AJAX issues.
* COMPATIBILITY - SiteOrigin Widgets Bundle Compatibility replaced with [WP-Stateless - SiteOrigin Widgets Bundle Addon](https://wordpress.org/plugins/wp-stateless-siteorigin-widgets-bundle-addon/).
* COMPATIBILITY - WPForms Compatibility replaced with [WP-Stateless - WPForms Addon](https://wordpress.org/plugins/wp-stateless-wpforms-addon/).
* COMPATIBILITY - Easy Digital Downloads Compatibility replaced with [WP-Stateless - Easy Digital Downloads Addon](https://wordpress.org/plugins/wp-stateless-easy-digital-downloads-addon/).
* COMPATIBILITY - LiteSpeed Cache Compatibility replaced with [WP-Stateless - LiteSpeed Cache Addon](https://wordpress.org/plugins/wp-stateless-litespeed-cache-addon/).
* COMPATIBILITY - BuddyPress Compatibility replaced with [WP-Stateless - BuddyPress Addon](https://wordpress.org/plugin/wp-stateless-buddypress-addon/).
* FIX: remove PHP warning on `Status` settings tab.
* FIX: database updates to resolve conflicts with Polylang Pro compatibility.
= 4.1.1 =
* FIX - cache issues during Data Optimization.
= 4.1.0 =
* NEW - move compatibilities files from `wp_sm_sync` to `wp_stateless_files` table with extended information.
* COMPATIBILITY - WooCommerce Compatibility replaced with [WP-Stateless – WooCommerce Addon](https://wordpress.org/plugins/wp-stateless-woocommerce-addon/).
* COMPATIBILITY - Gravity Forms Compatibility replaced with [WP-Stateless – Gravity Forms Addon](https://wordpress.org/plugins/wp-stateless-gravity-forms-addon/).
* COMPATIBILITY - Gravity Forms Signature Compatibility replaced with [WP-Stateless – Gravity Forms Signature Addon](https://wordpress.org/plugins/wp-stateless-gravity-forms-signature-addon/).
* COMPATIBILITY - Divi Theme Compatibility replaced with [WP-Stateless – Divi Theme Addon](https://wordpress.org/plugins/wp-stateless-divi-theme-addon/).
* COMPATIBILITY - SiteOrigin CSS Compatibility replaced with [WP-Stateless – SiteOrigin CSS Addon](https://wordpress.org/plugins/wp-stateless-siteorigin-css-addon/).
* ENHANCEMENT - CLI command `wp stateless migrate` supports `auto` parameter to run all required Data Optimizations automatically.
* ENHANCEMENT - Updated Client library for Google APIs from 2.15.1 to 2.17.0.
* ENHANCEMENT - updated `firebase/php-jwt` library from from 6.9.0 to 6.10.1.
* ENHANCEMENT - updated `wpmetabox/meta-box` library from from 5.8.2 to 5.10.1.
* ENHANCEMENT - updated `deliciousbrains/wp-background-processing` library from from 1.1.1 to 1.3.1.
* ENHANCEMENT - updated `composer/installers` library from from 1.12.1 to 2.3.0.
* ENHANCEMENT - updated `Meta Box Tabs` library from 1.1.17 to 1.1.18.
* ENHANCEMENT - action `sm:sync::addFile` format changed, now it passes media object instead of file name.
* ENHANCEMENT - for installed Addons replace Download action with Activate.
* ENHANCEMENT - count compatibility files from the DB instead of listing actual files to increase performance.
* FIX - CLI command `wp stateless migrate` supports `--yes` parameter to skip confirmation.
* FIX - CLI command `wp stateless migrate` correctly works with `--progress` parameter in multisite.
* FIX - fixed synchronization for Compatibility files in Stateless Mode.
* FIX - CLI command `wp stateless upgrade` fixed when running with `--b` switch.
* FIX - fixed SiteOrigin Widgets Bundle Compatibility in `Stateless` mode.
* FIX - fixed WPForms Compatibility in `Stateless` mode.
* FIX - limit index size for compatibility with different DB engines [757](https://github.com/udx/wp-stateless/issues/757).
* FIX - correctly disable `Cache-Busting` setting for Ephemeral Mode [758](https://github.com/udx/wp-stateless/issues/758), credits [@Jessedev1](https://github.com/Jessedev1).
* FIX - Data Optimization UI adjustments.
= 4.0.4 =
* ENHANCEMENT - display success message after copying Status Info.
* FIX - `Settings` page does not open or slow when there is big amount of attachments.
* FIX - in multisite network, removing custom tables properly when deleting site.
* FIX - skip setting ACL in Stateless mode and during Sync for the buckets with Uniform access, support WP_STATELESS_SKIP_ACL_SET constant [#712](https://github.com/udx/wp-stateless/issues/712).
= 4.0.3 =
* NEW - added `Info` section to the `Status` tab on the Settings page, which contains the system info and the ability to copy report to clipboard.
* ENHANCEMENT - added `Documentation` link on the Plugins page.
* ENHANCEMENT - added `Addons` link on the Plugins page.
* ENHANCEMENT - added `Documentation` link on the Settings page.
* FIX - fixed `Settings` shortcut on the Plugins page.
* FIX - in multisite network, do not show Data Optimization on the Network Admin Page.
* FIX - properly set `Content Disposition` fields for media objects.
* FIX - properly use `Cache Control` setting for media objects.
* FIX - fixed `Creation of dynamic property` PHP deprecation notice.
* FIX - fixed `Cannot use ::class with dynamic class name` PHP warning.
* FIX - avoid PHP warning when unable to get file path in `Stateless` mode [728](https://github.com/udx/wp-stateless/issues/728).
* FIX - fixed links to the constants documentation.
= 4.0.2 =
* FIX - in multisite network, deleting site can potentially remove WP-Stateless tables from another site.
* COMPATIBILITY - Gravity Forms Compatibility updated for the newest Gravity Forms version.
= 4.0.1 =
* FIX - improvements to Data Optimization process.
* FIX - Data Optimization fixed for multisite environment.
= 4.0.0 =
* NEW - use custom database tables to store GCS file data. This increases plugin performance and will be used for future improvements.
* NEW - added filter `wp_stateless_get_file`, retrieves the GCS file data, should be used instead of getting `sm_cloud` postmeta directly.
* NEW - added filter `wp_stateless_get_file_sizes`, retrieves the GCS file data for image sizes, should be used instead of getting `sm_cloud` postmeta directly.
* NEW - added filter `wp_stateless_get_file_meta`, retrieves all GCS file meta data, should be used instead of getting `sm_cloud` postmeta directly.
* NEW - added filter `wp_stateless_get_file_meta_value`, retrieves the GCS file meta data by meta_key, should be used instead of getting `sm_cloud` postmeta directly.
* NEW - added filter `wp_stateless_get_setting_...` which allows to override any WP-Stateless setting.
* NEW - added setting "Send Status Emails" allowing to change email for WP-Stateless notifications.
* NEW - added setting "Use Post Meta" allowing to switch back to using `postmeta` instead of custom DB tables. Can be used in case of issues after upgrading to 4.0.0.
* NEW - added new Settings tab `Addons`, which contains the list of WP-Stateless Addons, which replace Compatibilities.
* NEW - added new Settings tab `Status`, which contains status and health information related to Google Cloud Storage and WP-Stateless.
* NEW - CLI command `wp stateless migrate` to list and operate data optimizations.
* NEW - configuration constant [`WP_STATELESS_POSTMETA`](https://stateless.udx.io/docs/constants/#wp_stateless_postmeta) allows to read the GCS file data from postmeta instead of the new custom database tables.
* NEW - configuration constant [`WP_STATELESS_BATCH_HEALTHCHECK_INTERVAL`](https://stateless.udx.io/docs/constants/#wp_stateless_batch_healthcheck_interval) defines an interval in minutes for periodical health checks of a batch background process (like data optimization).
* COMPATIBILITY - BuddyBoss Compatibility replaced with [WP-Stateless – BuddyBoss Platform Addon](https://wordpress.org/plugins/wp-stateless-buddyboss-platform-addon/).
* COMPATIBILITY - Elementor Compatibility replaced with [WP-Stateless – Elementor Website Builder Addon](https://wordpress.org/plugins/wp-stateless-elementor-website-builder-addon/).
* COMPATIBILITY - Gravity Form Compatibility does not support older version of Gravity Forms (< 2.3).
* ENHANCEMENT - Allow dismissing notices in Admin Panel only for logged in users.
* ENHANCEMENT - Updated `wp-background-processing` library from from 1.0.2 to 1.1.1.
* ENHANCEMENT - Updated `phpseclib` 3.0.34 to 3.0.37.
* FIX - proper use of infinite timeout in `set_time_limit` function to avoid issues with PHP 8.1 and above [#704](https://github.com/udx/wp-stateless/issues/704).
= 3.4.1 =
* FIX - improve security while processing AJAX requests in Admin Panel
= 3.4.0 =
* ENHANCEMENT - removed `udx/lib-settings` package dependency for security reasons.
* ENHANCEMENT - removed `udx/lib-utility` package dependency for security reasons.
* ENHANCEMENT - refactored `Settings` admin page to remove Angular dependency.
* ENHANCEMENT - including Software Bill of Materials (SBOM) to GitHub release.
* FIX - updated package dependencies for Google Client Library for security reasons.
* FIX - replaced `utf8_encode` with `mb_convert_encoding` to support PHP 8.2 and above [#678](https://github.com/udx/wp-stateless/issues/678).
* FIX - Fatal Error in `Stateless` mode if GCP access credentials are wrong [#693](https://github.com/udx/wp-stateless/issues/693).
* COMPATIBILITY - preventing PHP warnings while working with WooCommerce version 8.4.0 and above [696](https://github.com/udx/wp-stateless/issues/696).
* COMPATIBILITY - avoiding conflicts between builtin compatibilities and WP-Stateless Addon plugins.
= 3.3.0 =
* NEW - Added new filter `wp_stateless_attachment_url`. Allows to customize attachment URL after WP-Stateless generates it based on it's internal conditions.
* FIX - Stateless mode Incompatible with Media Uploader in Media Library Grid mode [#675](https://github.com/udx/wp-stateless/issues/675).
* FIX - Prevent duplicating messages in Admin Panel.
* COMPATIBILITY - Dynamic Image Support is now part of the core.
* COMPATIBILITY - Google App Engine is now part of the core. Automatically enables **Stateless** mode when Google App Engine detected. Can be disabled using `WP_STATELESS_COMPATIBILITY_GAE` constant.
* COMPATIBILITY - Removed compatibility with "Advanced Custom Fields: Image Crop Add-on", because plugin is deprecated.
* COMPATIBILITY - Removed compatibility with "VidoRev" plugin.
* COMPATIBILITY - Removed compatibility with "WP Retina 2x" plugin.
* ENHANCEMENT - Updated Client library for Google APIs from 2.15.0 to 2.15.1.
* ENHANCEMENT - Updated Meta Box library from 5.6.3 to 5.8.2.
* ENHANCEMENT - Updated Meta Box Tabs to version 1.1.17.
* ENHANCEMENT - Updated PHP JWT library from 6.6.0 to 6.9.0.
= 3.2.5 =
* FIX - Folder setting does not allow custom structure [#608](https://github.com/udx/wp-stateless/issues/608).
* FIX - Stateless mode Incompatible with Inline Uploader [#675](https://github.com/udx/wp-stateless/issues/675).
* FIX - html tags incorrectly applied in notice [#680](https://github.com/udx/wp-stateless/issues/680).
* ENHANCEMENT - Add WP_STATELESS_SKIP_ACL_SET for skip ACL set for GCS [#625](https://github.com/udx/wp-stateless/issues/625).
* COMPATIBILITY - Add support for The Events Calendar [#599](https://github.com/udx/wp-stateless/issues/599).
= 3.2.4 =
* FIX - Website unresponsive after Upgrade [#669](https://github.com/udx/wp-stateless/issues/669).
= 3.2.3 =
* ENHANCEMENT - Updated Client library for Google APIs.
* ENHANCEMENT - Updated Monolog library to version 3.
* ENHANCEMENT - Updated JWT library.
* FIX - Fixed vulnerability issues.
* FIX - Fixed an errors and warnings on PHP 8.1.
* FIX - Fixed an error that occured when WP_STATELESS_MEDIA_UPLOAD_CHUNK_SIZE is set.
= 3.2.2 =
* FIX - Folder setting can't be saved from the settings page [#639](https://github.com/udx/wp-stateless/issues/639).
= 3.2.1 =
* FIX - Updated requirments.
* FIX - WP-Stateless 3.2.0 doesn’t upload docs, only images [#638](https://github.com/udx/wp-stateless/issues/638).
= 3.2.0 =
* ENHANCEMENT - Upgraded `wpmetabox` library.
* ENHANCEMENT - Updated Client library for Google APIs.
* ENHANCEMENT - Updated Guzzle library to version 7.
* ENHANCEMENT - Updated JWT library.
* ENHANCEMENT - Updated `license` functionality, removed `update checker`.
* FIX - Fixed vulnerability issues.
* FIX - Fixed erros and warnings on PHP 8.
* FIX - problem after the upgrade [#628](https://github.com/udx/wp-stateless/issues/628).
* FIX - image_downsize() PHP8 Required parameter $id follows optional parameter $false [#619](https://github.com/udx/wp-stateless/issues/619).
= 3.1.1 =
* ENHANCEMENT - Notification for the administrator about finished synchronization. GitHub issue [#576](https://github.com/udx/wp-stateless/issues/576).
* FIX - Fixed an issue with PDF thumbnails. GitHub issue [#577](https://github.com/udx/wp-stateless/issues/577).
* FIX - Fixed an issue with synchronization in `Stateless` mode. GitHub issue [#575](https://github.com/udx/wp-stateless/issues/575).
* COMPATIBILITY - Changed the way compatibility files are stored on Multisite. GitHub issue [#588](https://github.com/udx/wp-stateless/issues/588).
= 3.1.0 =
* NEW - Completely rewritten the synchronization tool. GitHub issue [#523](https://github.com/udx/wp-stateless/issues/523).
* NEW - New configuration constant `WP_STATELESS_SYNC_MAX_BATCH_SIZE`. Sets the maximum size of a background sync batch of items to be saved in a single row in the database. [More details](https://stateless.udx.io/docs/constants/#wp_stateless_sync_max_batch_size).
* NEW - New configuration constant `WP_STATELESS_SYNC_LOG`. Sets a path to a log file where to output logging information during the background sync. [More details](https://stateless.udx.io/docs/constants/#wp_stateless_sync_log).
* NEW - New configuration constant `WP_STATELESS_SYNC_HEALTHCHECK_INTERVAL`. Defines an interval in minutes for a cron task that periodically checks the health of a particular background sync process. [More details](https://stateless.udx.io/docs/constants/#wp_stateless_sync_healthcheck_interval).
* FIX - Fixed an issue when original files were not deleted from the server in the Ephemeral mode. GitHub issue [#484](https://github.com/udx/wp-stateless/issues/484).
* FIX - Fixed an incorrect behavior of image `srcset` attribute in the Backup mode. GitHub issue [#558](https://github.com/udx/wp-stateless/issues/558).
* COMPATIBILITY - Litespeed Cache - Fixed an incorrect upload folder determination. GitHub issue [#527](https://github.com/udx/wp-stateless/issues/527).
= 3.0.4 =
* FIX - Fixed inability to use dashes in the upload folder name. GitHub issue [#565](https://github.com/udx/wp-stateless/issues/565).
* COMPATIBILITY - Elementor - Fixed wrong upload directory. GitHub issue [#560](https://github.com/udx/wp-stateless/issues/560).
= 3.0.3 =
* FIX - Fixed an incorrect file URL in Stateless mode on Edit Media screen. GitHub issue [#544](https://github.com/udx/wp-stateless/issues/544).
= 3.0.2 =
* FIX - Refactored the way files are being uploaded to GCS when `WP_STATELESS_MEDIA_UPLOAD_CHUNK_SIZE` constant is defined. GitHub issue [#553](https://github.com/udx/wp-stateless/issues/553).
* FIX - Fixed the process of upgrading to 3.0 for multisite installations. GitHub issue [#549](https://github.com/udx/wp-stateless/issues/549).
= 3.0.1 =
* FIX - Fatal Error in Stateless mode. GitHub issue [#546](https://github.com/udx/wp-stateless/issues/546).
= 3.0 =
* NEW - Setup assistant rewrite. GitHub issue [#477](https://github.com/udx/wp-stateless/issues/477).
* NEW - Recreate attachment metabox panel using metabox.io. GitHub issue [#470](https://github.com/udx/wp-stateless/issues/470).
* NEW - Updated the `Stateless` mode to not use local storage at all. Current `Stateless` mode setting mapped to new `Ephemeral` mode. GitHub issue [#482](https://github.com/udx/wp-stateless/issues/482).
* NEW - Files are now uploaded to GCS in chunks and chunk size will be determined based on free memory available. GitHub issue [#478](https://github.com/udx/wp-stateless/issues/478).
* NEW - File upload chunk size can be controlled with `WP_STATELESS_MEDIA_UPLOAD_CHUNK_SIZE` constant. GitHub issue [#478](https://github.com/udx/wp-stateless/issues/478).
* FIX - Changed the default value for the Cache-Busting setting. GitHub issue [#361](https://github.com/udx/wp-stateless/issues/361).
* FIX - Fixed network override of Cache-Busting. GitHub issue [#468](https://github.com/udx/wp-stateless/issues/468).
* FIX - Fixed "Passing glue string after array is deprecated.". GitHub issue [#444](https://github.com/udx/wp-stateless/issues/444).
* FIX - Fixed Compatibility default value in multisite. GitHub issue [#464](https://github.com/udx/wp-stateless/issues/464).
* FIX - Fixed multisite wrong GCS path. GitHub issue [#407](https://github.com/udx/wp-stateless/issues/407).
* FIX - Don't check for Google Cloud Storage connectivity in stateless mode unless uploading. GitHub issue [#442](https://github.com/udx/wp-stateless/issues/442).
* COMPATIBILITY - Google App Engine - Added new compatibility support for Google App Engine. [#486](https://github.com/udx/wp-stateless/issues/486)
* COMPATIBILITY - Elementor - Fixed wrong MIME type for CSS files. GitHub issue [#395](https://github.com/udx/wp-stateless/issues/395).
* COMPATIBILITY - Polylang - Fixed missing metadata issue. GitHub issue [#378](https://github.com/udx/wp-stateless/issues/378).
* COMPATIBILITY - EWWW - Fixed mime type for WEBP images. GitHub issue [#371](https://github.com/udx/wp-stateless/issues/371).
* COMPATIBILITY - Simple Local Avatars - Added new compatibility support for Simple Local Avatars. GitHub issue [#297](https://github.com/udx/wp-stateless/issues/297).
* COMPATIBILITY - BuddyPress - Fixed BuddyPress compatibility. GitHub issue [#275](https://github.com/udx/wp-stateless/issues/275).
* COMPATIBILITY - Divi - Fixed Divi cache issue. GitHub issue [#430](https://github.com/udx/wp-stateless/issues/430).
* COMPATIBILITY - Gravity Forms - add compatibility for Gravity Forms Signature Add-On. [#501](https://github.com/udx/wp-stateless/issues/501).
* COMPATIBILITY - Litespeed - Fixed fatal error and warnings. [#491](https://github.com/udx/wp-stateless/issues/491).
* COMPATIBILITY - Imagify - Added support for webp. [#403](https://github.com/udx/wp-stateless/issues/403).
* ENHANCEMENT - Update Client library for Google APIs. [#446](https://github.com/udx/wp-stateless/issues/446).
* ENHANCEMENT - Wildcards for bucket folder settings. GitHub issue [#149](https://github.com/udx/wp-stateless/issues/149).
* ENHANCEMENT - Better CLI integration. GitHub issue [#447](https://github.com/udx/wp-stateless/issues/447), [#450](https://github.com/udx/wp-stateless/issues/450) and [#451](https://github.com/udx/wp-stateless/issues/451).
* ENHANCEMENT - Sync media according to new Bucket Folder settings. GitHub issue [#449](https://github.com/udx/wp-stateless/issues/449).
* ENHANCEMENT - Moved Bucket Folder setting in the File URL section. GitHub issue [#463](https://github.com/udx/wp-stateless/issues/463).
* ENHANCEMENT - Hide Regenerate and Sync with GCS when the mode is Disabled. GitHub issue [#440](https://github.com/udx/wp-stateless/issues/440).
* ENHANCEMENT - New endpoint for the Google Cloud Storage JSON API. GitHub issue [#384](https://github.com/udx/wp-stateless/issues/384).
* ENHANCEMENT - Renamed current `Stateless` mode to `Ephemeral`. GitHub issue [#481](https://github.com/udx/wp-stateless/issues/481).
= 2.3.2 =
* FIX - Fixed video file doesn't get deleted from the server in `Stateless` mode. GitHub issue [#418](https://github.com/wpCloud/wp-stateless/issues/418).
* FIX - Fixed file size doesn't show under attachment details in `Stateless` mode. GitHub issue [#413](https://github.com/wpCloud/wp-stateless/issues/413).
* FIX - Fixed Cache-Busting feature works even if the Mode is `Disabled`. GitHub issue [#405](https://github.com/wpCloud/wp-stateless/issues/405).
* COMPATIBILITY - Fixed Gravity Form Post Image didn't include `Bucket Folder`. GitHub issue [#421](https://github.com/wpCloud/wp-stateless/issues/421).
* COMPATIBILITY - Fixed Divi Builder Export. GitHub issue [#420](https://github.com/wpCloud/wp-stateless/issues/420).
* COMPATIBILITY - Fixed BuddyBoss pages breaking after updating to 2.3.0. GitHub issue [#417](https://github.com/wpCloud/wp-stateless/issues/417).
= 2.3.1 =
* Fix - Fixed fatal error, undefined function `is_wp_version_compatible`. GitHub issue [#414](https://github.com/wpCloud/wp-stateless/issues/414).
= 2.3.0 =
* FIX - Fixed problem with WordPress 5.3. GitHub issue [#406](https://github.com/wpCloud/wp-stateless/issues/406).
* FIX - Fixed problem with the Cache Busting feature. GitHub issue [#377](https://github.com/wpCloud/wp-stateless/issues/377).
* COMPATIBILITY - Added compatibility support for WP Retina 2x pro. GitHub issue [#380](https://github.com/wpCloud/wp-stateless/issues/380).
* COMPATIBILITY - Enhanced compatibility support for LiteSpeed Cache. GitHub issue [#365](https://github.com/wpCloud/wp-stateless/issues/365).
* COMPATIBILITY - Enhanced compatibility support for ShortPixel Image Optimizer. GitHub issue [#364](https://github.com/wpCloud/wp-stateless/issues/364), [#398](https://github.com/wpCloud/wp-stateless/issues/398).
* COMPATIBILITY - Fixed Gravity Form export. GitHub issue [#408](https://github.com/wpCloud/wp-stateless/issues/408).
* ENHANCEMENT - Improved upon add_media function for better compatibility support. GitHub issue [#382](https://github.com/wpCloud/wp-stateless/issues/382).
= 2.2.7 =
* FIX - WP-Smush compatibility enhanced. GitHub Issue [#366](https://github.com/wpCloud/wp-stateless/issues/366).
* FIX - Fixed multisite installation support. GitHub Issue [#370](https://github.com/wpCloud/wp-stateless/issues/370).
* FIX - Fixed settings UI problems related to Cache-Busting option. GitHub Issue [#373](https://github.com/wpCloud/wp-stateless/issues/373).
* FIX - Other minor fixes.
= 2.2.6 =
* FIX - Multisite Network Settings page fixed. GitHub Issue [#369](https://github.com/wpCloud/wp-stateless/issues/369).
* FIX - Fixed incorrect Compatibilities behavior when Bucket Folder is set. GitHub Issue [#368](https://github.com/wpCloud/wp-stateless/issues/368).
* FIX - Other minor fixes.
= 2.2.5 =
* NEW - Added ability to start sync process from specific Attachment ID. GitHub Issue [#360](https://github.com/wpCloud/wp-stateless/issues/360).
* COMPATIBILITY - Added compatibility support for LiteSpeed Cache plugin. Especially to support optimized .webp images. GitHub Issue [#357](https://github.com/wpCloud/wp-stateless/issues/357).
* FIX - Other minor fixes.
= 2.2.4 =
* NEW - Added new filter `wp_stateless_skip_add_media`. Allows skipping synchronization of the media object with GCS depending on custom condition. GitHub Issue [#344](https://github.com/wpCloud/wp-stateless/issues/344).
* FIX - Compatibility Manager is considering Child Themes now. GitHub Issue [#351](https://github.com/wpCloud/wp-stateless/issues/351).
* FIX - Custom domains handling has been fixed. GitHub Issue [#358](https://github.com/wpCloud/wp-stateless/issues/358).
* ENHANCEMENT - Imagify Image Optimizer and WP Smush compatibilities improved. GitHub Issue [#359](https://github.com/wpCloud/wp-stateless/issues/359).
= 2.2.3 =
* FIX - get_post_metadata does not break multi-dimensional arrays anymore. GitHub Issue [#352](https://github.com/wpCloud/wp-stateless/issues/352).
* FIX - PHP Warning: substr_compare() fixed. GitHub Issue [#350](https://github.com/wpCloud/wp-stateless/issues/350).
* FIX - Filtering Domain setting before saving in order to get rid of possible empty spaces. GitHub Issue [#348](https://github.com/wpCloud/wp-stateless/issues/348).
* FIX - Incorrect remote file path generated when disabled Organization setting. GitHub Issue [#343](https://github.com/wpCloud/wp-stateless/issues/343).
* FIX - Hiding admin notices correctly. GitHub Pull Request [#355](https://github.com/wpCloud/wp-stateless/pull/355).
= 2.2.2 =
* FIX - Proper 'srcset' attribute handling. GitHub Issue [#342](https://github.com/wpCloud/wp-stateless/issues/342).
* ENHANCEMENT - Minor fixes code quality.
= 2.2.1 =
* Fix - Security patch for Authenticated Remote Code Execution (RCE) vulnerability.
= 2.2.0 =
* FIX - Slow page generation when File URL Replacement is enabled. https://github.com/wpCloud/wp-stateless/issues/265
* FIX - Fatal error when WP Smush Pro compatibility is enabled. https://github.com/wpCloud/wp-stateless/issues/325
* FIX - Issue with Imagify. https://github.com/wpCloud/wp-stateless/issues/326
* FIX - Return correct srcset images. https://github.com/wpCloud/wp-stateless/issues/328
* FIX - Fatal error with GFForms. https://github.com/wpCloud/wp-stateless/issues/330
* FIX - Typo in admin notices. https://github.com/wpCloud/wp-stateless/issues/337
* ENHANCEMENT - Extended “File URL Replacement” options. https://github.com/wpCloud/wp-stateless/issues/336
* ENHANCEMENT - Service Account JSON is now hidden if set via constant. https://github.com/wpCloud/wp-stateless/issues/320
* ENHANCEMENT - New database table for tracking files not tracked in media library. https://github.com/wpCloud/wp-stateless/issues/307
* ENHANCEMENT - Updated depreciated function flagged by security software. https://github.com/wpCloud/wp-stateless/issues/300
= 2.1.9 =
* FIX - Resolved fatal error with OneCodeShop RML Amazon S3 plugin. GitHub Issue [#317](https://github.com/wpCloud/wp-stateless/issues/317).
* FIX - Resolved missing bucket in file URL when “storage.googleapis.com” was supplied in Domain field. GitHub Issue [318](https://github.com/wpCloud/wp-stateless/issues/318).
* ENHANCEMENT - Support synchronization of files without metadata, such as .doc and .docx files. GitHub Issue [316](https://github.com/wpCloud/wp-stateless/issues/316).
= 2.1.8 =
* FIX - Woocommerce product export.
* FIX - Allow webmaster to control http or https.
* FIX - PDF preview sync.
* ENHANCEMENT - Improved error message when there is nothing to sync.
* ENHANCEMENT - Renamed constant WP_STATELESS_MEDIA_HASH_FILENAME to WP_STATELESS_MEDIA_CACHE_BUSTING.
* ENHANCEMENT - Domain field functionality now allows webmaster to control http or https
* ENHANCEMENT - Message about Stateless mode now requires the Cache-Busting option now see only those who using Stateless mode.
* ENHANCEMENT - Upload full size image before generating thumbnails.
* COMPATIBILITY - Added support for Learndash plugin.
* COMPATIBILITY - Added support for BuddyPress plugin.
* COMPATIBILITY - Added support for Divi builder export.
* COMPATIBILITY - Added support for Elementor plugin.
= 2.1.7 =
* ENHANCEMENT - Display dashboard-wide notice for existing users explaining stateless mode now enables cache-busting option.
* ENHANCEMENT - Display notice when selecting stateless mode explaining stateless mode now enables cache-busting option.
* ENHANCEMENT - Display required message on cache-busting setting description when stateless mode is enabled.
= 2.1.6 =
* FIX - Resolved Google SDK conflict.
* FIX - ICompatibility.php errors notice.
* FIX - Undefined index: gs_link in class-bootstrap.php.
* FIX - Media files with accent characters would not upload correctly to the bucket.
* ENHANCEMENT - Force `Cache-Busting` when using `Stateless` mode.
* ENHANCEMENT - New admin notice design.
* ENHANCEMENT - Improved and clear error message.
* ENHANCEMENT - Renamed constant `WP_STATELESS_MEDIA_ON_FLY` to `WP_STATELESS_DYNAMIC_IMAGE_SUPPORT`.
* ENHANCEMENT - Update Google Libraries.
* ENHANCEMENT - Renamed constant `WP_STATELESS_MEDIA_HASH_FILENAME` to `WP_STATELESS_MEDIA_CACHE_BUSTING`.
* COMPATIBILITY - Renamed constant `WP_STATELESS_COMPATIBILITY_WPSmush` to `WP_STATELESS_COMPATIBILITY_WPSMUSH`.
* COMPATIBILITY - Added support for `WooCommerce Extra Product Options`.
* COMPATIBILITY - Added support for `WPForms Pro`.
* COMPATIBILITY - Improved `ShortPixel` compatibility.
* COMPATIBILITY - Fixed `ACF Image Crop` compatibility.
= 2.1.5 =
* FIX - Fatal error with PHP 5.4.45 on activation.
* FIX - E_WARNING: Illegal string offset ‘gs_bucket’.
* FIX - Resolved ‘save_network_settings’ message when saving network settings.
* COMPATIBILITY - Added support for WP Forms plugin
* COMPATIBILITY - Added support for WP Smush plugin
* COMPATIBILITY - Added support for ShortPixel Image Optimizer plugin.
* COMPATIBILITY - Added support for Imagify Image Optimizer plugin.
* COMPATIBILITY - Added support for SiteOrigin CSS plugin.
* COMPATIBILITY - Added support for Gravity Forms plugin.
* COMPATIBILITY - Added support for WPBakery Page Builder plugin.
* COMPATIBILITY - Added wp-config constant support for compatibility options.
= 2.1.4 =
* ENHANCEMENT - Updated Google OAuth URL for Setup Assistant.
= 2.1.3 =
* ENHANCEMENT - Updates to text explainers in Setup Assistant.
* ENHANCEMENT - Refined redirection logic when activating plugin.
* FIX - Removed extra space in converted URLs.
= 2.1.2 =
* ENHANCEMENT - Improved support for Easy Digital Downloads.
* ENHANCEMENT - Added constant WP_STATELESS_CONSOLE_LOG check before logging to console.
* ENHANCEMENT - Changed service account default permissions on creation.
* COMPATIBILITY - Added support for SiteOrigin generated CSS files.
* ENHANCEMENT - Moved Dynamic Image Support to Capability tab.
* COMPATIBILITY - Added support for ACF Image Crop addon.
* FIX - Fixed compatibility issue with wp-smush plugin.
* FIX - Added required blog param for multi-sites.
* FIX - Updated media library and mediaItem API endpoints.
* COMPATIBILITY - Added support for EDD download method option.
= 2.1.1 =
* FIX - Fixed double slash when Organization is disabled.
* FIX - Fatal error with GuzzleHttp.
* FIX - Fixed content-type assignment.
* ENHANCEMENT - Added support for https URLs in Domain field.
* COMPATIBILITY - Advanced Custom Fields Image Crop Addon.
= 2.1.0 =
* FIX - Fixed read only for Service Account JSON if constant or environment variable is defined.
* FIX - Override default cache control.
* FIX - Fixed custom domain bucket support with setup assistant.
* FIX - Improved support for wp_calculate_image_srcset.
* FIX - Synchronizing non-image files will now delete the local copy.
* NEW - Support for GOOGLE_APPLICATION_CREDENTIALS environment variable.
* NEW - Added bucket region option to setup assistant.
* NEW - Added custom file type support for File URL Replacement setting.
* NEW - Added failover to image url when not found on disk for sync tool.
* ENHANCEMENT - updated service account role to Storage Object Admin.
= 2.0.3 =
* FIX - Fixed Fatal Error which was occurring on WordPress Multisite after upgrading plugin from 1.x to 2.x.
* ENHANCEMENT - Improved support of PDF files.
= 2.0.2 =
* FIX - Fixed Fatal Error which were caused by using PHP 5.4 and less.
* FIX - Fixed Fatal Error which was caused on Media page when WP Smush Pro plugin is activated.
* FIX - Fixed detection of plugin files paths. The issue was occurring on installations with custom file structures ( e.g. Bedrock platform ).
* FIX - Fixed redirection URL to Setup Wizard on plugin activation.
* ENHANCEMENT - Updated the minimum requirements for PHP to 5.5 to prevent fatal errors and possible warnings.
= 2.0.1 =
* ENHANCEMENT - Added compatibility with Google SDK v1.x version to prevent conflicts with third-party plugins.
* ENHANCEMENT - Added warning message if old Google SDK version is loaded by third-party plugin.
= 2.0.0 =
* NEW - Added stateless mode.
* NEW - Dedicated settings panel.
* NEW - Setup assistant for initial plugin activation.
* NEW - Support for replacing default GCS domain with custom domain.
* ENHANCEMENT - Expanded network setting overrides.
* ENHANCEMENT - Expanded wp-config constants.
* ENHANCEMENT - Relocated synchronization and regeneration tools to new settings panel.
= 1.9.2 =
* ENHANCEMENT - Added ability to modify default bucket link via 'wp_stateless_bucket_link' filter.
* ENHANCEMENT - Added checking of connection to GCS once per four hours instead of doing it on every page load.
* ENHANCEMENT - Google SDK was moved from vendor dir. So it's not loaded on every page load anymore, but only when it's required.
* ENHANCEMENT - Updated Composer Autoload logic.
* ENHANCEMENT - Reverted all changes included to 1.9.1 version because of conflicts.
= 1.9.0 =
* NEW - Added new ability to define cacheControl for remote objects.
* NEW - Added new option that adds random hashes to file names.
= 1.8.0 =
* FIX - Fixed the issue on multisite setup (switch_to_blog now works as expected).
* FIX - Performance fixes.
* NEW - Added the ability to regenerate and synchronize separate Media file from the list.
* NEW - Added the ability to regenerate and synchronize Media file from edit screen.
* ENHANCEMENT - UI cleanup.
= 1.7.3 =
* Initial public release.
================================================
FILE: changes.md
================================================
#### 4.4.1 - 2026-01-16
* COMPATIBILITY - WooCommerce Extra Product Options Compatibility replaced with [WP-Stateless – WooCommerce Extra Product Options Addon](https://wordpress.org/plugins/wp-stateless-woocommerce-extra-product-options-addon/).
* FIX - resolve critical errors with `firebase/php-jwt` library if `AUTH_SALT` WordPress constant is not set or too short.
#### 4.4.0 - 2026-01-10
* NEW - plugin requires PHP 8.1+.
* ENHANCEMENT - updated `firebase/php-jwt` library from 6.11.1 to 7.0.2.
* ENHANCEMENT - Updated Client library for Google APIs from 2.18.3 to 2.19.0.
* ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.15 to 5.10.19.
* ENHANCEMENT - updated `Meta Box Tabs` library from 1.1.18 to 1.2.0.
* FIX - `udx/lib-wp-bootstrap` package correctly loads text domain to prevent PHP notices.
#### 4.3.0
* ENHANCEMENT - update dependencies for Google APIs Client Library.
* COMPATIBILITY - Simple Local Avatars Compatibility replaced with [WP-Stateless - Simple Local Avatars Addon](https://wordpress.org/plugins/wp-stateless-simple-local-avatars-addon/).
#### 4.2.1
* ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.11 to 5.10.15.
* FIX - correctly loads text domain to prevent PHP notices.
* FIX - `udx/lib-ud-api-client` package correctly loads text domain to prevent PHP notices.
#### 4.2.0
* ENHANCEMENT - Updated Client library for Google APIs from 2.18.2 to 2.18.3.
* ENHANCEMENT - updated `firebase/php-jwt` library from 6.10.2 to 6.11.1.
* ENHANCEMENT - updated `wpmetabox/meta-box` library from 5.10.1 to 5.10.11.
* DEPRECATED - Setup Assistant removed.
#### 4.1.3
* COMPATIBILITY - PolyLang Compatibility replaced with [WP-Stateless – Polylang Pro Addon](https://wordpress.org/plugins/wp-stateless-polylang-pro-addon/).
* ENHANCEMENT - updated `wpmetabox/meta-box` library from from 5.10.1 to 5.10.7.
* ENHANCEMENT - updated `Meta Box Tabs` library from 1.1.18 to 1.2.0.
* ENHANCEMENT - updated `firebase/php-jwt` library from from 6.10.1 to 6.10.2.
* ENHANCEMENT - Updated Client library for Google APIs from 2.17.0 to 2.18.2.
* FIX - apply `Cache Control` setting to all files (previously applied only to images).
#### 4.1.2
* ENHANCEMENT - added `REST API Endpoint` setting, which useful when WordPress dashboard and frontend website utilize different domain names.
* ENHANCEMENT - extended `Status Info` with the information to help diagnose REST API or AJAX issues.
* COMPATIBILITY - SiteOrigin Widgets Bundle Compatibility replaced with [WP-Stateless - SiteOrigin Widgets Bundle Addon](https://wordpress.org/plugins/wp-stateless-siteorigin-widgets-bundle-addon/).
* COMPATIBILITY - WPForms Compatibility replaced with [WP-Stateless - WPForms Addon](https://wordpress.org/plugins/wp-stateless-wpforms-addon/).
* COMPATIBILITY - Easy Digital Downloads Compatibility replaced with [WP-Stateless - Easy Digital Downloads Addon](https://wordpress.org/plugins/wp-stateless-easy-digital-downloads-addon/).
* COMPATIBILITY - LiteSpeed Cache Compatibility replaced with [WP-Stateless - LiteSpeed Cache Addon](https://wordpress.org/plugins/wp-stateless-litespeed-cache-addon/).
* COMPATIBILITY - BuddyPress Compatibility replaced with [WP-Stateless - BuddyPress Addon](https://wordpress.org/plugin/wp-stateless-buddypress-addon/).
* FIX: PHP warning on `Status` settings tab.
* FIX: database updates to resolve conflicts with Polylang Pro compatibility.
#### 4.1.1
* FIX - cache issues during Data Optimization.
#### 4.1.0
* NEW - move compatibilities files from `wp_sm_sync` to `wp_stateless_files` table with extended information.
* COMPATIBILITY - WooCommerce Compatibility replaced with [WP-Stateless – WooCommerce Addon](https://wordpress.org/plugins/wp-stateless-woocommerce-addon/).
* COMPATIBILITY - Gravity Forms Compatibility replaced with [WP-Stateless – Gravity Forms Addon](https://wordpress.org/plugins/wp-stateless-gravity-forms-addon/).
* COMPATIBILITY - Gravity Forms Signature Compatibility replaced with [WP-Stateless – Gravity Forms Signature Addon](https://wordpress.org/plugins/wp-stateless-gravity-forms-signature-addon/).
* COMPATIBILITY - Divi Theme Compatibility replaced with [WP-Stateless – Divi Theme Addon](https://wordpress.org/plugins/wp-stateless-divi-theme-addon/).
* COMPATIBILITY - SiteOrigin CSS Compatibility replaced with [WP-Stateless – SiteOrigin CSS Addon](https://wordpress.org/plugins/wp-stateless-siteorigin-css-addon/).
* ENHANCEMENT - CLI command `wp stateless migrate` supports `auto` parameter to run all required Data Optimizations automatically.
* ENHANCEMENT - Updated Client library for Google APIs from 2.15.1 to 2.17.0.
* ENHANCEMENT - updated `firebase/php-jwt` library from from 6.9.0 to 6.10.1.
* ENHANCEMENT - updated `wpmetabox/meta-box` library from from 5.8.2 to 5.10.1.
* ENHANCEMENT - updated `deliciousbrains/wp-background-processing` library from from 1.1.1 to 1.3.1.
* ENHANCEMENT - updated `composer/installers` library from from 1.12.1 to 2.3.0.
* ENHANCEMENT - updated `Meta Box Tabs` library from 1.1.17 to 1.1.18.
* ENHANCEMENT - action `sm:sync::addFile` format changed, now it passes media object instead of file name.
* ENHANCEMENT - for installed Addons replace Download action with Activate.
* ENHANCEMENT - count compatibility files from the DB instead of listing actual files to increase performance.
* FIX - CLI command `wp stateless migrate` supports `--yes` parameter to skip confirmation.
* FIX - CLI command `wp stateless migrate` correctly works with `--progress` parameter in multisite.
* FIX - fixed synchronization for Compatibility files in Stateless Mode.
* FIX - CLI command `wp stateless upgrade` fixed when running with `--b` switch.
* FIX - fixed SiteOrigin Widgets Bundle Compatibility in `Stateless` mode.
* FIX - fixed WPForms Compatibility in `Stateless` mode.
* FIX - limit index size for compatibility with different DB engines [757](https://github.com/udx/wp-stateless/issues/757).
* FIX - correctly disable `Cache-Busting` setting for Ephemeral Mode [758](https://github.com/udx/wp-stateless/issues/758), credits [@Jessedev1](https://github.com/Jessedev1).
* FIX - Data Optimization UI adjustments.
#### 4.0.4
* ENHANCEMENT - display success message after copying Status Info.
* FIX - `Settings` page does not open or slow when there is big amount of attachments.
* FIX - in multisite network, removing custom tables properly when deleting site.
* FIX - skip setting ACL in Stateless mode and during Sync for the buckets with Uniform access, support WP_STATELESS_SKIP_ACL_SET constant [#712](https://github.com/udx/wp-stateless/issues/712).
#### 4.0.3
* NEW - added `Info` section to the `Status` tab on the Settings page, which contains the system info and the ability to copy report to clipboard.
* ENHANCEMENT - added `Documentation` link on the Plugins page.
* ENHANCEMENT - added `Addons` link on the Plugins page.
* ENHANCEMENT - added `Documentation` link on the Settings page.
* FIX - fixed `Settings` shortcut on the Plugins page.
* FIX - in multisite network, do not show Data Optimization on the Network Admin Page.
* FIX - properly set `Content Disposition` fields for media objects.
* FIX - properly use `Cache Control` setting for media objects.
* FIX - fixed `Creation of dynamic property` PHP deprecation notice.
* FIX - fixed `Cannot use ::class with dynamic class name` PHP warning.
* FIX - avoid PHP warning when unable to get file path in `Stateless` mode [728](https://github.com/udx/wp-stateless/issues/728).
* FIX - fixed links to the constants documentation.
#### 4.0.2
* FIX - in multisite network, deleting site can potentially remove WP-Stateless tables from another site.
* COMPATIBILITY - Gravity Forms Compatibility updated for the newest Gravity Forms version.
#### 4.0.1
* FIX - improvements to Data Optimization process.
* FIX - Data Optimization fixed for multisite environment.
#### 4.0.0
* NEW - use custom database tables to store GCS file data. This increases plugin performance and will be used for future improvements.
* NEW - added filter `wp_stateless_get_file`, retrieves the GCS file data, should be used instead of getting `sm_cloud` postmeta directly.
* NEW - added filter `wp_stateless_get_file_sizes`, retrieves the GCS file data for image sizes, should be used instead of getting `sm_cloud` postmeta directly.
* NEW - added filter `wp_stateless_get_file_meta`, retrieves all GCS file meta data, should be used instead of getting `sm_cloud` postmeta directly.
* NEW - added filter `wp_stateless_get_file_meta_value`, retrieves the GCS file meta data by meta_key, should be used instead of getting `sm_cloud` postmeta directly.
* NEW - added filter `wp_stateless_get_setting_...` which allows to override any WP-Stateless setting.
* NEW - added setting "Send Status Emails" allowing to change email for WP-Stateless notifications.
* NEW - added setting "Use Post Meta" allowing to switch back to using `postmeta` instead of custom DB tables. Can be used in case of issues after upgrading to 4.0.0.
* NEW - added new Settings tab `Addons`, which contains the list of WP-Stateless Addons, which replace Compatibilities.
* NEW - added new Settings tab `Status`, which contains status and health information related to Google Cloud Storage and WP-Stateless.
* NEW - CLI command `wp stateless migrate` to list and operate data optimizations.
* NEW - configuration constant [`WP_STATELESS_POSTMETA`](https://stateless.udx.io/docs/constants/#wp_stateless_postmeta) allows to read the GCS file data from postmeta instead of the new custom database tables.
* NEW - configuration constant [`WP_STATELESS_BATCH_HEALTHCHECK_INTERVAL`](https://stateless.udx.io/docs/constants/#wp_stateless_batch_healthcheck_interval) defines an interval in minutes for periodical health checks of a batch background process (like data optimization).
* COMPATIBILITY - BuddyBoss Compatibility replaced with [WP-Stateless – BuddyBoss Platform Addon](https://wordpress.org/plugins/wp-stateless-buddyboss-platform-addon/).
* COMPATIBILITY - Elementor Compatibility replaced with [WP-Stateless – Elementor Website Builder Addon](https://wordpress.org/plugins/wp-stateless-elementor-website-builder-addon/).
* COMPATIBILITY - Gravity Form Compatibility does not support older version of Gravity Forms (< 2.3).
* ENHANCEMENT - Allow dismissing notices in Admin Panel only for logged in users.
* ENHANCEMENT - Updated `wp-background-processing` library from from 1.0.2 to 1.1.1.
* ENHANCEMENT - Updated `phpseclib` 3.0.34 to 3.0.37.
* FIX - proper use of infinite timeout in `set_time_limit` function to avoid issues with PHP 8.1 and above [#704](https://github.com/udx/wp-stateless/issues/704).
#### 3.4.1
* FIX - improve security while processing AJAX requests in Admin Panel
#### 3.4.0
* ENHANCEMENT - removed `udx/lib-settings` package dependency for security reasons.
* ENHANCEMENT - removed `udx/lib-utility` package dependency for security reasons.
* ENHANCEMENT - refactored `Settings` admin page to remove Angular dependency.
* ENHANCEMENT - including Software Bill of Materials (SBOM) to GitHub release.
* FIX - updated package dependencies for Google Client Library for security reasons.
* FIX - replaced `utf8_encode` with `mb_convert_encoding` to support PHP 8.2 and above [#678](https://github.com/udx/wp-stateless/issues/678).
* FIX - Fatal Error in `Stateless` mode if GCP access credentials are wrong [#693](https://github.com/udx/wp-stateless/issues/693).
* COMPATIBILITY - preventing PHP warnings while working with WooCommerce version 8.4.0 and above [696](https://github.com/udx/wp-stateless/issues/696).
* COMPATIBILITY - avoiding conflicts between builtin compatibilities and WP-Stateless Addon plugins.
#### 3.3.0
* NEW - Added new filter `wp_stateless_attachment_url`. Allows to customize attachment URL after WP-Stateless generates it based on it's internal conditions.
* FIX - Stateless mode Incompatible with Media Uploader in Media Library Grid mode [#675](https://github.com/udx/wp-stateless/issues/675).
* FIX - Prevent duplicating messages in Admin Panel.
* COMPATIBILITY - Dynamic Image Support is now part of the core.
* COMPATIBILITY - Google App Engine is now part of the core. Automatically enables **Stateless** mode when Google App Engine detected. Can be disabled using `WP_STATELESS_COMPATIBILITY_GAE` constant.
* COMPATIBILITY - Removed compatibility with "Advanced Custom Fields: Image Crop Add-on", because plugin is deprecated.
* COMPATIBILITY - Removed compatibility with "VidoRev" plugin.
* COMPATIBILITY - Removed compatibility with "WP Retina 2x" plugin.
* ENHANCEMENT - Updated Client library for Google APIs from 2.15.0 to 2.15.1.
* ENHANCEMENT - Updated Meta Box library from 5.6.3 to 5.8.2.
* ENHANCEMENT - Updated Meta Box Tabs to version 1.1.17.
* ENHANCEMENT - Updated PHP JWT library from 6.6.0 to 6.9.0.
#### 3.2.5
* FIX - Folder setting does not allow custom structure [#608](https://github.com/udx/wp-stateless/issues/608).
* FIX - Stateless mode Incompatible with Inline Uploader [#675](https://github.com/udx/wp-stateless/issues/675).
* FIX - html tags incorrectly applied in notice [#680](https://github.com/udx/wp-stateless/issues/680).
* ENHANCEMENT - Add WP_STATELESS_SKIP_ACL_SET for skip ACL set for GCS [#625](https://github.com/udx/wp-stateless/issues/625).
* COMPATIBILITY - Add support for The Events Calendar [#599](https://github.com/udx/wp-stateless/issues/599).
#### 3.2.4
- FIX - Website unresponsive after Upgrade [#669](https://github.com/udx/wp-stateless/issues/669).
#### 3.2.3
- ENHANCEMENT - Updated Client library for Google APIs.
- ENHANCEMENT - Updated Monolog library to version 3.
- ENHANCEMENT - Updated JWT library.
- FIX - Fixed vulnerability issues.
- FIX - Fixed an errors and warnings on PHP 8.1.
- FIX - Fixed an error that occured when WP_STATELESS_MEDIA_UPLOAD_CHUNK_SIZE is set.
#### 3.2.2
- FIX - Folder setting can't be saved from the settings page [#639](https://github.com/udx/wp-stateless/issues/639).
#### 3.2.1
- FIX - Updated requirments.
- FIX - WP-Stateless 3.2.0 doesn’t upload docs, only images [#638](https://github.com/udx/wp-stateless/issues/638).
#### 3.2.0
- ENHANCEMENT - Upgraded `wpmetabox` library.
- ENHANCEMENT - Updated Client library for Google APIs.
- ENHANCEMENT - Updated Guzzle library to version 7.
- ENHANCEMENT - Updated JWT library.
- ENHANCEMENT - Updated `license` functionality, removed `update checker`.
- FIX - Fixed vulnerability issues.
- FIX - Fixed erros and warnings on PHP 8.
- FIX - problem after the upgrade [#628](https://github.com/udx/wp-stateless/issues/628).
- FIX - image_downsize() PHP8 Required parameter $id follows optional parameter $false [#619](https://github.com/udx/wp-stateless/issues/619).
#### 3.1.1
- ENHANCEMENT - Notification for the administrator about finished synchronization. GitHub issue [#576](https://github.com/udx/wp-stateless/issues/576).
- FIX - Fixed an issue with PDF thumbnails. GitHub issue [#577](https://github.com/udx/wp-stateless/issues/577).
- FIX - Fixed an issue with synchronization in `Stateless` mode. GitHub issue [#575](https://github.com/udx/wp-stateless/issues/575).
- COMPATIBILITY - Changed the way compatibility files are stored on Multisite. GitHub issue [#588](https://github.com/udx/wp-stateless/issues/588).
#### 3.1.0
- NEW - Completely rewritten the synchronization tool. GitHub issue [#523](https://github.com/udx/wp-stateless/issues/523).
- NEW - New configuration constant `WP_STATELESS_SYNC_MAX_BATCH_SIZE`. Sets the maximum size of a background sync batch of items to be saved in a single row in the database. [More details](https://stateless.udx.io/docs/constants/#wp_stateless_sync_max_batch_size).
- NEW - New configuration constant `WP_STATELESS_SYNC_LOG`. Sets a path to a log file where to output logging information during the background sync. [More details](https://stateless.udx.io/docs/constants/#wp_stateless_sync_log).
- NEW - New configuration constant `WP_STATELESS_SYNC_HEALTHCHECK_INTERVAL`. Defines an interval in minutes for a cron task that periodically checks the health of a particular background sync process. [More details](https://stateless.udx.io/docs/constants/#wp_stateless_sync_healthcheck_interval).
- FIX - Fixed an issue when original files were not deleted from the server in the Ephemeral mode. GitHub issue [#484](https://github.com/udx/wp-stateless/issues/484).
- FIX - Fixed an incorrect behavior of image `srcset` attribute in the Backup mode. GitHub issue [#558](https://github.com/udx/wp-stateless/issues/558).
- COMPATIBILITY - Litespeed Cache - Fixed an incorrect upload folder determination. GitHub issue [#527](https://github.com/udx/wp-stateless/issues/527).
#### 3.0.4
- FIX - Fixed inability to use dashes in the upload folder name. GitHub issue [#565](https://github.com/udx/wp-stateless/issues/565).
- COMPATIBILITY - Elementor - Fixed wrong upload directory. GitHub issue [#560](https://github.com/udx/wp-stateless/issues/560).
#### 3.0.3
- FIX - Fixed an incorrect file URL in Stateless mode on Edit Media screen. GitHub issue [#544](https://github.com/udx/wp-stateless/issues/544).
#### 3.0.2
- FIX - Refactored the way files are being uploaded to GCS when `WP_STATELESS_MEDIA_UPLOAD_CHUNK_SIZE` constant is defined. GitHub issue [#553](https://github.com/udx/wp-stateless/issues/553).
- FIX - Fixed the process of upgrading to 3.0 for multisite installations. GitHub issue [#549](https://github.com/udx/wp-stateless/issues/549).
#### 3.0.1
- FIX - Fatal Error in Stateless mode. GitHub issue [#546](https://github.com/udx/wp-stateless/issues/546).
#### 3.0
- NEW - Setup assistant rewrite. GitHub issue [#477](https://github.com/udx/wp-stateless/issues/477).
- NEW - Recreate attachment metabox panel using metabox.io. GitHub issue [#470](https://github.com/udx/wp-stateless/issues/470).
- NEW - Updated the `Stateless` mode to not use local storage at all. Current `Stateless` mode setting mapped to new `Ephemeral` mode. GitHub issue [#482](https://github.com/udx/wp-stateless/issues/482).
- NEW - Files are now uploaded to GCS in chunks and chunk size will be determined based on free memory available. GitHub issue [#478](https://github.com/udx/wp-stateless/issues/478).
- NEW - File upload chunk size can be controlled with `WP_STATELESS_MEDIA_UPLOAD_CHUNK_SIZE` constant. GitHub issue [#478](https://github.com/udx/wp-stateless/issues/478).
- FIX - Changed the default value for the Cache-Busting setting. GitHub issue [#361](https://github.com/udx/wp-stateless/issues/361).
- FIX - Fixed network override of Cache-Busting. GitHub issue [#468](https://github.com/udx/wp-stateless/issues/468).
- FIX - Fixed "Passing glue string after array is deprecated.". GitHub issue [#444](https://github.com/udx/wp-stateless/issues/444).
- FIX - Fixed Compatibility default value in multisite. GitHub issue [#464](https://github.com/udx/wp-stateless/issues/464).
- FIX - Fixed multisite wrong GCS path. GitHub issue [#407](https://github.com/udx/wp-stateless/issues/407).
- FIX - Don't check for Google Cloud Storage connectivity in stateless mode unless uploading. GitHub issue [#442](https://github.com/udx/wp-stateless/issues/442).
- COMPATIBILITY - Google App Engine - Added new compatibility support for Google App Engine. [#486](https://github.com/udx/wp-stateless/issues/486)
- COMPATIBILITY - Elementor - Fixed wrong MIME type for CSS files. GitHub issue [#395](https://github.com/udx/wp-stateless/issues/395).
- COMPATIBILITY - Polylang - Fixed missing metadata issue. GitHub issue [#378](https://github.com/udx/wp-stateless/issues/378).
- COMPATIBILITY - EWWW - Fixed mime type for WEBP images. GitHub issue [#371](https://github.com/udx/wp-stateless/issues/371).
- COMPATIBILITY - Simple Local Avatars - Added new compatibility support for Simple Local Avatars. GitHub issue [#297](https://github.com/udx/wp-stateless/issues/297).
- COMPATIBILITY - BuddyPress - Fixed BuddyPress compatibility. GitHub issue [#275](https://github.com/udx/wp-stateless/issues/275).
- COMPATIBILITY - Divi - Fixed Divi cache issue. GitHub issue [#430](https://github.com/udx/wp-stateless/issues/430).
- COMPATIBILITY - Gravity Forms - add compatibility for Gravity Forms Signature Add-On. [#501](https://github.com/udx/wp-stateless/issues/501).
- COMPATIBILITY - Litespeed - Fixed fatal error and warnings. [#491](https://github.com/udx/wp-stateless/issues/491).
- COMPATIBILITY - Imagify - Added support for webp. [#403](https://github.com/udx/wp-stateless/issues/403).
- ENHANCEMENT - Update Client library for Google APIs. [#446](https://github.com/udx/wp-stateless/issues/446).
- ENHANCEMENT - Wildcards for bucket folder settings. GitHub issue [#149](https://github.com/udx/wp-stateless/issues/149).
- ENHANCEMENT - Better CLI integration. GitHub issue [#447](https://github.com/udx/wp-stateless/issues/447), [#450](https://github.com/udx/wp-stateless/issues/450) and [#451](https://github.com/udx/wp-stateless/issues/451).
- ENHANCEMENT - Sync media according to new Bucket Folder settings. GitHub issue [#449](https://github.com/udx/wp-stateless/issues/449).
- ENHANCEMENT - Moved Bucket Folder setting in the File URL section. GitHub issue [#463](https://github.com/udx/wp-stateless/issues/463).
- ENHANCEMENT - Hide Regenerate and Sync with GCS when the mode is Disabled. GitHub issue [#440](https://github.com/udx/wp-stateless/issues/440).
- ENHANCEMENT - New endpoint for the Google Cloud Storage JSON API. GitHub issue [#384](https://github.com/udx/wp-stateless/issues/384).
- ENHANCEMENT - Renamed current `Stateless` mode to `Ephemeral`. GitHub issue [#481](https://github.com/udx/wp-stateless/issues/481).
#### 2.3.2
- FIX - Fixed video file doesn't get deleted from the server in `Stateless` mode. GitHub issue [#418](https://github.com/wpCloud/wp-stateless/issues/418).
- FIX - Fixed file size doesn't show under attachment details in `Stateless` mode. GitHub issue [#413](https://github.com/wpCloud/wp-stateless/issues/413).
- FIX - Fixed Cache-Busting feature works even if the Mode is `Disabled`. GitHub issue [#405](https://github.com/wpCloud/wp-stateless/issues/405).
- COMPATIBILITY - Fixed Gravity Form Post Image didn't include `Bucket Folder`. GitHub issue [#421](https://github.com/wpCloud/wp-stateless/issues/421).
- COMPATIBILITY - Fixed Divi Builder Export. GitHub issue [#420](https://github.com/wpCloud/wp-stateless/issues/420).
- COMPATIBILITY - Fixed BuddyBoss pages breaking after updating to 2.3.0. GitHub issue [#417](https://github.com/wpCloud/wp-stateless/issues/417).
#### 2.3.1
- Fix - Fixed fatal error, undefined function `is_wp_version_compatible`. GitHub issue [#414](https://github.com/wpCloud/wp-stateless/issues/414).
#### 2.3.0
- FIX - Fixed problem with WordPress 5.3. GitHub issue [#406](https://github.com/wpCloud/wp-stateless/issues/406).
- FIX - Fixed problem with the Cache Busting feature. GitHub issue [#377](https://github.com/wpCloud/wp-stateless/issues/377).
- COMPATIBILITY - Added compatibility support for WP Retina 2x pro. GitHub issue [#380](https://github.com/wpCloud/wp-stateless/issues/380).
- COMPATIBILITY - Enhanced compatibility support for LiteSpeed Cache. GitHub issue [#365](https://github.com/wpCloud/wp-stateless/issues/365).
- COMPATIBILITY - Enhanced compatibility support for ShortPixel Image Optimizer. GitHub issue [#364](https://github.com/wpCloud/wp-stateless/issues/364), [#398](https://github.com/wpCloud/wp-stateless/issues/398).
- COMPATIBILITY - Fixed Gravity Form export. GitHub issue [#408](https://github.com/wpCloud/wp-stateless/issues/408).
- ENHANCEMENT - Improved upon add_media function for better compatibility support. GitHub issue [#382](https://github.com/wpCloud/wp-stateless/issues/382).
#### 2.2.7
- FIX - WP-Smush compatibility enhanced. GitHub Issue [#366](https://github.com/wpCloud/wp-stateless/issues/366).
- FIX - Fixed multisite installation support. GitHub Issue [#370](https://github.com/wpCloud/wp-stateless/issues/370).
- FIX - Fixed settings UI problems related to Cache-Busting option. GitHub Issue [#373](https://github.com/wpCloud/wp-stateless/issues/373).
- FIX - Other minor fixes.
#### 2.2.6
- FIX - Multisite Network Settings page fixed. GitHub Issue [#369](https://github.com/wpCloud/wp-stateless/issues/369).
- FIX - Fixed incorrect Compatibilities behavior when Bucket Folder is set. GitHub Issue [#368](https://github.com/wpCloud/wp-stateless/issues/368).
- FIX - Other minor fixes.
#### 2.2.5
- NEW - Added ability to start sync process from specific Attachment ID. GitHub Issue [#360](https://github.com/wpCloud/wp-stateless/issues/360).
- COMPATIBILITY - Added compatibility support for LiteSpeed Cache plugin. Especially to support optimized .webp images. GitHub Issue [#357](https://github.com/wpCloud/wp-stateless/issues/357).
- FIX - Other minor fixes.
#### 2.2.4
- NEW - Added new filter `wp_stateless_skip_add_media`. Allows skipping synchronization of the media object with GCS depending on custom condition. GitHub Issue [#344](https://github.com/wpCloud/wp-stateless/issues/344).
- FIX - Compatibility Manager is considering Child Themes now. GitHub Issue [#351](https://github.com/wpCloud/wp-stateless/issues/351).
- FIX - Custom domains handling has been fixed. GitHub Issue [#358](https://github.com/wpCloud/wp-stateless/issues/358).
- ENHANCEMENT - Imagify Image Optimizer and WP Smush compatibilities improved. GitHub Issue [#359](https://github.com/wpCloud/wp-stateless/issues/359).
#### 2.2.3
- FIX - `get_post_metadata` does not break multi-dimensional arrays anymore. GitHub Issue [#352](https://github.com/wpCloud/wp-stateless/issues/352).
- FIX - `PHP Warning: substr_compare()` fixed. GitHub Issue [#350](https://github.com/wpCloud/wp-stateless/issues/350).
- FIX - Filtering Domain setting before saving in order to get rid of possible empty spaces. GitHub Issue [#348](https://github.com/wpCloud/wp-stateless/issues/348).
- FIX - Incorrect remote file path generated when disabled Organization setting. GitHub Issue [#343](https://github.com/wpCloud/wp-stateless/issues/343).
- FIX - Hiding admin notices correctly. GitHub Pull Request [#355](https://github.com/wpCloud/wp-stateless/pull/355).
#### 2.2.2
- FIX - Proper 'srcset' attribute handling. GitHub Issue [#342](https://github.com/wpCloud/wp-stateless/issues/342).
- ENHANCEMENT - Minor fixes code quality.
#### 2.2.1
- Fix - Security patch for Authenticated Remote Code Execution (RCE) vulnerability.
#### 2.2.0
- FIX - Slow page generation when File URL Replacement is enabled [#265](https://github.com/wpCloud/wp-stateless/issues/265).
- FIX - Fatal error when WP Smush Pro compatibility is enabled [#325](https://github.com/wpCloud/wp-stateless/issues/325).
- FIX - Issue with Imagify [#326](https://github.com/wpCloud/wp-stateless/issues/326).
- FIX - Return correct srcset images [#328](https://github.com/wpCloud/wp-stateless/issues/328).
- FIX - Fatal error with GFForms [#330](https://github.com/wpCloud/wp-stateless/issues/330).
- FIX - Typo in admin notices [#337](https://github.com/wpCloud/wp-stateless/issues/337).
- ENHANCEMENT - Extended “File URL Replacement” options [#336](https://github.com/wpCloud/wp-stateless/issues/336).
- ENHANCEMENT - Service Account JSON is now hidden if set via constant [#320](https://github.com/wpCloud/wp-stateless/issues/320).
- ENHANCEMENT - New database table for tracking files not tracked in media library [#307](https://github.com/wpCloud/wp-stateless/issues/307).
- ENHANCEMENT - Updated depreciated function flagged by security software [#300](https://github.com/wpCloud/wp-stateless/issues/300).
#### 2.1.9
- FIX - Resolved fatal error with OneCodeShop RML Amazon S3 plugin. GitHub Issue [#317](https://github.com/wpCloud/wp-stateless/issues/317).
- FIX - Resolved missing bucket in file URL when “storage.googleapis.com” was supplied in Domain field. GitHub Issue [#318](https://github.com/wpCloud/wp-stateless/issues/318).
- ENHANCEMENT - Support synchronization of files without metadata, such as .doc and .docx files. GitHub Issue [#316](https://github.com/wpCloud/wp-stateless/issues/316).
#### 2.1.8
- FIX - WooCommerce product export.
- FIX - PDF previews in media library now supported.
- ENHANCEMENT - Improved error message when there is nothing to sync.
- ENHANCEMENT - Renamed constant WP_STATELESS_MEDIA_HASH_FILENAME to WP_STATELESS_MEDIA_CACHE_BUSTING.
- ENHANCEMENT - Domain field functionality now allows webmaster to control http or https
- ENHANCEMENT - Notice about Stateless mode requiring the Cache-Busting option is displayed to those using Stateless mode.
- ENHANCEMENT - Upload full size image before generating thumbnails.
- COMPATIBILITY - Added compatibility support for Learndash plugin.
- COMPATIBILITY - Added compatibility support for BuddyPress plugin.
- COMPATIBILITY - Added compatibility support for Divi Builder export.
- COMPATIBILITY - Added compatibility support for Elementor plugin.
#### 2.1.7
- ENHANCEMENT - Display dashboard-wide notice for existing users explaining stateless mode now enables cache-busting option.
- ENHANCEMENT - Display notice when selecting stateless mode explaining stateless mode now enables cache-busting option.
- ENHANCEMENT - Display required message on cache-busting setting description when stateless mode is enabled.
#### 2.1.6
- FIX - Resolved Google SDK conflict.
- FIX - ICompatibility.php errors notice.
- FIX - Undefined index: gs_link in class-bootstrap.php.
- FIX - Media files with accent characters would not upload correctly to the bucket.
- ENHANCEMENT - Force `Cache-Busting` when using `Stateless` mode.
- ENHANCEMENT - New admin notice design.
- ENHANCEMENT - Improved and clear error message.
- ENHANCEMENT - Renamed constant `WP_STATELESS_MEDIA_ON_FLY` to `WP_STATELESS_DYNAMIC_IMAGE_SUPPORT`.
- ENHANCEMENT - Update Google Libraries.
- ENHANCEMENT - Renamed constant `WP_STATELESS_MEDIA_HASH_FILENAME` to `WP_STATELESS_MEDIA_CACHE_BUSTING`.
- COMPATIBILITY - Renamed constant `WP_STATELESS_COMPATIBILITY_WPSmush` to `WP_STATELESS_COMPATIBILITY_WPSMUSH`.
- COMPATIBILITY - Added support for `WooCommerce Extra Product Options`.
- COMPATIBILITY - Added support for `WPForms Pro`.
- COMPATIBILITY - Improved `ShortPixel` compatibility.
- COMPATIBILITY - Fixed `ACF Image Crop` compatibility.
#### 2.1.5
- FIX - Fatal error with PHP 5.4.45 on activation.
- FIX - E_WARNING: Illegal string offset ‘gs_bucket’.
- FIX - Resolved ‘save_network_settings’ message when saving network settings.
- COMPATIBILITY - Added support for WP Forms plugin
- COMPATIBILITY - Added support for WP Smush plugin
- COMPATIBILITY - Added support for ShortPixel Image Optimizer plugin.
- COMPATIBILITY - Added support for Imagify Image Optimizer plugin.
- COMPATIBILITY - Added support for SiteOrigin CSS plugin.
- COMPATIBILITY - Added support for Gravity Forms plugin.
- COMPATIBILITY - Added support for WPBakery Page Builder plugin.
- COMPATIBILITY - Added wp-config constant support for compatibility options.
#### 2.1.4
- ENHANCEMENT - Updated Google OAuth URL for Setup Assistant.
#### 2.1.3
- ENHANCEMENT - Updates to text explainers in Setup Assistant.
- ENHANCEMENT - Refined redirection logic when activating plugin.
- FIX - Removed extra space in converted URLs.
#### 2.1.2
- ENHANCEMENT - Improved support for Easy Digital Downloads.
- ENHANCEMENT - Added constant WP_STATELESS_CONSOLE_LOG check before logging to console.
- ENHANCEMENT - Changed service account default permissions on creation.
- COMPATIBILITY - Added support for SiteOrigin generated CSS files.
- ENHANCEMENT - Moved Dynamic Image Support to Capability tab.
- COMPATIBILITY - Added support for ACF Image Crop addon.
- FIX - Fixed compatibility issue with wp-smush plugin.
- FIX - Added required blog param for multi-sites.
- FIX - Updated media library and mediaItem API endpoints.
- COMPATIBILITY - Added support for EDD download method option.
#### 2.1.1
- FIX - Fixed double slash when Organization is disabled.
- FIX - Fatal error with GuzzleHttp.
- FIX - Fixed content-type assignment.
- ENHANCEMENT - Added support for https URLs in Domain field.
- COMPATIBILITY - Advanced Custom Fields Image Crop Addon.
#### 2.1.0
- FIX - Fixed read only for Service Account JSON if constant or environment variable is defined.
- FIX - Override default cache control.
- FIX - Fixed custom domain bucket support with setup assistant.
- FIX - Improved support for wp_calculate_image_srcset.
- FIX - Synchronizing non-image files will now delete the local copy.
- NEW - Support for GOOGLE_APPLICATION_CREDENTIALS environment variable.
- NEW - Added bucket region option to setup assistant.
- NEW - Added custom file type support for File URL Replacement setting.
- NEW - Added failover to image url when not found on disk for sync tool.
- ENHANCEMENT - updated service account role to Storage Object Admin.
#### 2.0.3
- FIX - Fixed Fatal Error which was occurring on WordPress Multisite after upgrading plugin from 1.x to 2.x.
- ENHANCEMENT - Improved support of PDF files.
#### 2.0.2
- FIX - Fixed Fatal Errors which were caused by using PHP 5.4 and less.
- FIX - Fixed Fatal Error which was caused on Media page when WP Smush Pro plugin is activated.
- FIX - Fixed detection of plugin files paths. The issue was occurring on installations with custom file structures ( e.g. Bedrock platform ).
- FIX - Fixed redirection URL to Setup Wizard on plugin activation.
- ENHANCEMENT - Updated the minimum requirements for PHP to 5.5 to prevent fatal errors and possible warnings.
#### 2.0.1
- ENHANCEMENT - Added compatibility with Google SDK v1.x version to prevent conflicts with third-party plugins.
- ENHANCEMENT - Added warning message if old Google SDK version is loaded by third-party plugin.
#### 2.0.0
- NEW - Added stateless mode.
- NEW - Dedicated settings panel.
- NEW - Setup assistant for initial plugin activation.
- NEW - Support for replacing default GCS domain with a custom domain.
- ENHANCEMENT - Expanded network setting overrides.
- ENHANCEMENT - Expanded wp-config constants.
- ENHANCEMENT - Relocated synchronization and regeneration tools to the new settings panel.
#### 1.9.2
- ENHANCEMENT - Added ability to modify default bucket link via 'wp_stateless_bucket_link' filter.
- ENHANCEMENT - Added checking of connection to GCS once per four hours instead of doing it on every page load.
- ENHANCEMENT - Google SDK was moved from vendor dir. So it's not loaded on every page load anymore, but only when it's required.
- ENHANCEMENT - Updated Composer Autoload logic.
- ENHANCEMENT - Reverted all changes included to 1.9.1 version because of conflicts.
#### 1.9.0
- Added new ability to define cacheControl for remote objects.
- Added new option that adds random hashes to file names.
#### 1.8.0
- Added the ability to regenerate and synchronize separate Media file from the list.
- Added the ability to regenerate and synchronize Media file from edit screen.
- Fixed the issue on multisite setup (switch_to_blog now works as expected).
- Performance fixes.
- UI cleanup.
#### 1.7.3
- Added ability to fix previously failed items.
#### 1.7.1
- Migrated from p12 to JSON.
- New feature of media sync.
- New option Root Directory.
- Optimized uploading process.
- Other options.
#### 1.7.0
- Fixed conflict with SSL forcing plugin.
#### 1.6.0
- Plugin Updates ability added.
- WordPress 4.4 compatibility fixed.
- Post content filter fixed.
#### 1.5.0
- Migration into wp-stateless from wp-stateless-media.
- Version bump to resolve bucket permissions issues.
#### 1.3.2
- Fixed issue with wp_normalize_path causing a fatal error on older installs.
- Removed \$\_SESSION usage for transients.
#### 1.3.1
- Added ability to upload non-images to bucket.
- Fixed issue with running batches in WP CLI
#### 1.3.0
- Added WP CLI functionality.
- Added WP CLI command to move all legacy meta data to serialized array.
- Changed the way of storing SM cloud meta data.
#### 1.2.0
- Added Imagemagic/GD check to warn admin that thumbnails will not be generated.
- Added mediaLink, mediaLink and id storage for uploaded objects.
- Added support for cacheControl with default settings based on Mime type of upload.
- Added sm:item:cacheControl and sm:item:contentDisposition filters.
- Cleaned-up metadata that is made available to GCS and visible in response headers.
- Removed app_name, using blog domain name automatically.
- Added Cache Control to media editor.
#### 1.1.0
- Added support for WP_STATELESS_MEDIA_MODE.
- Renamed constants STATELESS_MEDIA_SERVICE_ACCOUNT_NAME and STATELESS_MEDIA_KEY_FILE_PATH to WP_STATELESS_MEDIA_SERVICE_ACCOUNT and WP_STATELESS_MEDIA_KEY_FILE_PATH.
#### 1.0.2
- Added a _view_ link to media edit page for synchronized items.
- Added some _wp_get_attachment_image_ dynamic attributes.
#### 1.0.1
- Added Network Management option.
- Added support for WP_STATELESS_MEDIA_SERVICE_ACCOUNT_NAME and WP_STATELESS_MEDIA_KEY_FILE_PATH.
#### 1.0.0
- Set branch to v1.0.
- Removed autocompletion from Email Address and Application Name fields.
- Moved lib/classes into just lib.
- Rename class-Bootstrap.php to be lowercased.
- Added composer/installers to composer.json 'required' dependencies.
- Rename stateless-media.php to wp-stateless-media.php so there aren't unexpected plugin basename issues.
- Change package name to wp-stateless-media in package.json
- Rename 'wpCloud/wp-stateless-media' to 'wpcloud/wp-stateless-media' in composer.json, Composer does not allow uppercase names.
#### 0.2.1
- Added 'Settings' link to plugin list.
================================================
FILE: composer.json
================================================
{
"name": "wpcloud/wp-stateless",
"description": "WP-Stateless WordPress plugin",
"type": "wordpress-plugin",
"minimum-stability": "stable",
"homepage": "https://udx.io",
"authors": [
{
"name": "UDX",
"homepage": "https://udx.io"
}
],
"repositories": [
{
"type": "composer",
"url": "https://repository.usabilitydynamics.com"
},
{
"type": "git",
"url": "https://github.com/wpCloud/wp-stateless.git"
},
{
"type":"composer",
"url":"https://wpackagist.org",
"only": [
"wpackagist-plugin/*",
"wpackagist-theme/*"
]
}
],
"require": {
"php": ">=7.4",
"composer/installers": "~2.3",
"ccampbell/chromephp": "^4.1",
"firebase/php-jwt": "^6.1.2",
"udx/lib-ud-api-client": "^1.2",
"udx/lib-wp-bootstrap": "^1.3",
"wpackagist-plugin/meta-box": "^5.10"
},
"autoload": {
"classmap": [
"lib/classes",
"lib/includes"
]
},
"archive": {
"exclude": [
"node_modules",
".gitignore",
"test",
"circle.yml",
"composer.lock",
"gruntfile.js",
"package.json"
]
},
"extra": {
"mozart": {
"dep_namespace": "wpCloud\\StatelessMedia\\",
"dep_directory": "/lib/ns-vendor/deps",
"classmap_directory": "/lib/ns-vendor/classes",
"classmap_prefix": "UDX_",
"packages": [
"deliciousbrains/wp-background-processing"
]
},
"featureFlags": [
{
"name": "Google Login",
"constant": "WP_STATELESS_GOOGLE_LOGIN",
"description": "Allows for quicker setup by letting admin login to their Google Account from the control panel. Fetches available projects and buckets.",
"since": "1.9.2",
"enabled": true
},
{
"name": "Legacy Settings",
"constant": "WP_STATELESS_LEGACY_SETTINGS",
"description": "Shows legacy settings options.",
"since": "1.9.2",
"enabled": false
}
],
"schemas": {
"dependencies": {
"modules": {},
"plugins": []
},
"licenses": {
"client": {
"slug": "wpcloud/wp-stateless",
"screen": {
"parent": "upload.php?page=stateless-settings",
"hide_menu": true
}
},
"product": false
}
},
"installer-paths": {
"vendor/wpmetabox/meta-box": ["wpackagist-plugin/meta-box"]
}
},
"require-dev": {
"coenjacobs/mozart": "0.7.1",
"deliciousbrains/wp-background-processing": "1.3.1"
},
"config": {
"allow-plugins": {
"composer/installers": true
}
}
}
================================================
FILE: l10n.php
================================================
__( "Something went wrong", ud_get_stateless_media()->domain ),
'invalid_input' => __( "Form has invalid input. Please fix them.", ud_get_stateless_media()->domain ),
'json_api_enabled' => __( "Google Cloud Storage JSON API Service Enabled", ud_get_stateless_media()->domain ),
'json_api_enabled_failed' => __( "Google Cloud Storage JSON API Service failed.", ud_get_stateless_media()->domain ),
'project_cant_be_empty' => __( "Project name can't be empty.", ud_get_stateless_media()->domain ),
'project_length_notice' => __( "Project name must be between 5 and 30 characters.", ud_get_stateless_media()->domain ),
'project_invalid_char' => __( "Project name has invalid characters. Enter letters, numbers, quotes, hyphens, spaces or exclamation points.", ud_get_stateless_media()->domain ),
'project_creation_started' => __( "Project creation started.", ud_get_stateless_media()->domain ),
'project_exists' => __( "Project Exists", ud_get_stateless_media()->domain ),
'project_creation_complete' => __( "Project creation complete.", ud_get_stateless_media()->domain ),
'project_creation_failed' => __( "Project creation failed.", ud_get_stateless_media()->domain ),
'bucket_cant_be_empty' => __( "Bucket name can't be empty.", ud_get_stateless_media()->domain ),
'bucket_length_notice' => __( "Bucket name must be between 5 and 30 characters.", ud_get_stateless_media()->domain ),
'bucket_invalid_char' => __( "A bucket name can contain lowercase alphanumeric characters, hyphens, and underscores. Bucket names must start and end with an alphanumeric character.", ud_get_stateless_media()->domain ),
'bucket_created' => __( "Bucket Created", ud_get_stateless_media()->domain ),
'bucket_creation_failed' => __( "Bucket creation failed", ud_get_stateless_media()->domain ),
'bucket_exists' => __( "Bucket Exist", ud_get_stateless_media()->domain ),
'bucket_access_controls_success' => __( "Bucket access control inserted.", ud_get_stateless_media()->domain ),
'bucket_access_controls_failed' => __( "Bucket access control failed.", ud_get_stateless_media()->domain ),
'select_billing_account' => __( "Select a billing account.", ud_get_stateless_media()->domain ),
'billing_enabled' => __( "Billing Enabled", ud_get_stateless_media()->domain ),
'billing_already_enabled' => __( "Billing already enabled.", ud_get_stateless_media()->domain ),
'billing_failed' => __( "Field to enable billing.", ud_get_stateless_media()->domain ),
'billing_info' => __( "Billing Info", ud_get_stateless_media()->domain ),
'service_account_exist' => __( "Service Account Exists", ud_get_stateless_media()->domain ),
'service_account_created' => __( "Service Account Created", ud_get_stateless_media()->domain ),
'service_account_creation_failed' => __( "Service Account creation failed", ud_get_stateless_media()->domain ),
'service_account_key_created' => __( "Service Account Key Created", ud_get_stateless_media()->domain ),
'service_account_key_creation_failed' => __( "Service Account Key creation failed", ud_get_stateless_media()->domain ),
'service_account_key_saved' => __( "Service Account Key Saved", ud_get_stateless_media()->domain ),
'service_account_key_save_failed' => __( "Failed to Save Service Account Key", ud_get_stateless_media()->domain ),
'service_account_role_granted' => __( "Service Account Role Granted", ud_get_stateless_media()->domain ),
'service_account_role_grant_failed' => __( "Service Account Role Grant Failed", ud_get_stateless_media()->domain ),
'unable_to_connect_to_the_server' => __( "Unable to connect to the server", ud_get_stateless_media()->domain ),
'could_not_retrieve_progress' => __( "Could not retrieve progress", ud_get_stateless_media()->domain ),
'could_not_get_fails' => __( "Could not get fails", ud_get_stateless_media()->domain ),
'could_not_reset_progress' => __( "Could not reset progress", ud_get_stateless_media()->domain ),
'loading_images_media_objects' => __( "Loading Images Media Objects...", ud_get_stateless_media()->domain ),
'stopping' => __( "Stopping...", ud_get_stateless_media()->domain ),
'finished' => __( "Finished", ud_get_stateless_media()->domain ),
'cancelled' => __( "Cancelled", ud_get_stateless_media()->domain ),
'ids_are_malformed' => __( "IDs are malformed", ud_get_stateless_media()->domain ),
'unable_to_get_images_media_id' => __( "Unable to get Images Media ID", ud_get_stateless_media()->domain ),
'wp_stateless_get_images_media_id' => __( "WP-Stateless get Images Media ID", ud_get_stateless_media()->domain ),
'request_failed' => __( "Request failed", ud_get_stateless_media()->domain ),
'get_images_media_id' => __( "Get Images Media ID", ud_get_stateless_media()->domain ),
'loading_non_image_media_objects' => __( "Loading non-image Media Objects...", ud_get_stateless_media()->domain ),
'unable_to_get_non_images_media_id' => __('Unable to get non Images Media ID', ud_get_stateless_media()->domain ),
'non_libraries_files_are_not_found' => __('There are no files to process.', ud_get_stateless_media()->domain ),
'get_non_library_files_request_failed' => __('Get non library files: Request failed', ud_get_stateless_media()->domain ),
'regenerate_single_image_failed' => __('Regenerate single image: Failed', ud_get_stateless_media()->domain ),
'sync_single_file_failed' => __('Sync single file: Failed', ud_get_stateless_media()->domain ),
'sync_single_file_request_failed' => __('Sync single file: Request failed', ud_get_stateless_media()->domain ),
'failed_to_sync' => __('Failed to sync ', ud_get_stateless_media()->domain ),
'sync_non_library_file_failed' => __('Sync non library file: Failed', ud_get_stateless_media()->domain ),
'sync_non_library_file_request_failed' => __('Sync non library file: Request failed', ud_get_stateless_media()->domain ),
'response_code' => __('Response code: ', ud_get_stateless_media()->domain ),
'loading_non_library_objects' => __('Loading non library Objects...', ud_get_stateless_media()->domain ),
'processing_files' => __('Processing files (', ud_get_stateless_media()->domain ),
'_total___' => __(' total)...', ud_get_stateless_media()->domain ),
'processing_images' => __('Processing images (', ud_get_stateless_media()->domain ),
'get_non_images_media_id_request_failed' => __('Get non Images Media ID: Request failed', ud_get_stateless_media()->domain ),
'regenerate_single_image_request_failed' => __('Regenerate single image: Request failed', ud_get_stateless_media()->domain ),
'confirm' => __('Confirm', ud_get_stateless_media()->domain ),
'cancel' => __('Cancel', ud_get_stateless_media()->domain ),
'start_optimization' => __('Start Data Optimization', ud_get_stateless_media()->domain ),
'starting' => __('Starting...', ud_get_stateless_media()->domain ),
);
================================================
FILE: lib/Google/CHANGELOG.md
================================================
# Changelog
## [2.19.0](https://github.com/googleapis/google-api-php-client/compare/v2.18.4...v2.19.0) (2026-01-09)
### Features
* Support firebase/php-jwt version 6.0 and 7.0 ([#2696](https://github.com/googleapis/google-api-php-client/issues/2696)) ([70ea42a](https://github.com/googleapis/google-api-php-client/commit/70ea42a6aa29a1321825c3dcda39cf39174390ea))
### Bug Fixes
* Upload assets release job ([#2671](https://github.com/googleapis/google-api-php-client/issues/2671)) ([0f56ea7](https://github.com/googleapis/google-api-php-client/commit/0f56ea773cb51cc6131c442d112d7fd630b49b5c))
## [2.18.4](https://github.com/googleapis/google-api-php-client/compare/v2.18.3...v2.18.4) (2025-09-29)
### Bug Fixes
* Ensure credentials can be of type FetchAuthTokenInterface ([#2684](https://github.com/googleapis/google-api-php-client/issues/2684)) ([ed70802](https://github.com/googleapis/google-api-php-client/commit/ed70802cc4886ef1f513a2c0b56a8a972db5e7ab))
## [2.18.3](https://github.com/googleapis/google-api-php-client/compare/v2.18.2...v2.18.3) (2025-04-08)
### Bug Fixes
* Convert Finder lazy iterator to array before deletion ([#2663](https://github.com/googleapis/google-api-php-client/issues/2663)) ([c699405](https://github.com/googleapis/google-api-php-client/commit/c6994051af1568359c97d267d9ef34ccbda31387))
## [2.18.2](https://github.com/googleapis/google-api-php-client/compare/v2.18.1...v2.18.2) (2024-12-16)
### Bug Fixes
* Correct type for jwt constructor arg ([#2648](https://github.com/googleapis/google-api-php-client/issues/2648)) ([31a9861](https://github.com/googleapis/google-api-php-client/commit/31a9861af02a8e9070b395f05caed7ffce0ef8be))
## [2.18.1](https://github.com/googleapis/google-api-php-client/compare/v2.18.0...v2.18.1) (2024-11-24)
### Bug Fixes
* Implicitly marking parameter as nullable is deprecated ([#2638](https://github.com/googleapis/google-api-php-client/issues/2638)) ([de57db2](https://github.com/googleapis/google-api-php-client/commit/de57db2fdc0d56de1abbf778b28b77c3347eb3fd))
## [2.18.0](https://github.com/googleapis/google-api-php-client/compare/v2.17.0...v2.18.0) (2024-10-16)
### Features
* **docs:** Use doctum shared workflow for reference docs ([#2618](https://github.com/googleapis/google-api-php-client/issues/2618)) ([242e2cb](https://github.com/googleapis/google-api-php-client/commit/242e2cb09ad5b25b047a862b4d521037e74cae29))
### Bug Fixes
* Explicit token caching issue ([#2358](https://github.com/googleapis/google-api-php-client/issues/2358)) ([dc13e5e](https://github.com/googleapis/google-api-php-client/commit/dc13e5e3f517148d3c66d151a5ab133b7840d8fb))
## [2.17.0](https://github.com/googleapis/google-api-php-client/compare/v2.16.0...v2.17.0) (2024-07-10)
### Features
* Add logger to client constructor config ([#2606](https://github.com/googleapis/google-api-php-client/issues/2606)) ([1f47133](https://github.com/googleapis/google-api-php-client/commit/1f4713329d71111a317cda8ef8603fa1bdc88858))
* Add the protected apiVersion property ([#2588](https://github.com/googleapis/google-api-php-client/issues/2588)) ([7e79f3d](https://github.com/googleapis/google-api-php-client/commit/7e79f3d7be4811f760e19cc4a2c558e04196ec1d))
## [2.16.0](https://github.com/googleapis/google-api-php-client/compare/v2.15.4...v2.16.0) (2024-04-24)
### Features
* Add universe domain support ([#2563](https://github.com/googleapis/google-api-php-client/issues/2563)) ([35895de](https://github.com/googleapis/google-api-php-client/commit/35895ded90b507074b3430a94a5790ddd01f39f0))
## [2.15.4](https://github.com/googleapis/google-api-php-client/compare/v2.15.3...v2.15.4) (2024-03-06)
### Bug Fixes
* Updates phpseclib because of a security issue ([#2574](https://github.com/googleapis/google-api-php-client/issues/2574)) ([633d41f](https://github.com/googleapis/google-api-php-client/commit/633d41f1b65fdb71a83bf747f7a3ad9857f6d02a))
## [2.15.3](https://github.com/googleapis/google-api-php-client/compare/v2.15.2...v2.15.3) (2024-01-04)
### Bug Fixes
* Guzzle dependency version ([#2546](https://github.com/googleapis/google-api-php-client/issues/2546)) ([c270f28](https://github.com/googleapis/google-api-php-client/commit/c270f28b00594a151a887edd3cfd205594a1256a))
## [2.15.2](https://github.com/googleapis/google-api-php-client/compare/v2.15.1...v2.15.2) (2024-01-03)
### Bug Fixes
* Disallow vulnerable guzzle versions ([#2536](https://github.com/googleapis/google-api-php-client/issues/2536)) ([d1830ed](https://github.com/googleapis/google-api-php-client/commit/d1830ede17114a4951ab9e60b3b9bcd9393b8668))
* Php 8.3 deprecated get_class method call without argument ([#2509](https://github.com/googleapis/google-api-php-client/issues/2509)) ([8c66021](https://github.com/googleapis/google-api-php-client/commit/8c6602119b631e1a9da4dbe219af18d51c8dab8e))
* Phpseclib security vulnerability ([#2524](https://github.com/googleapis/google-api-php-client/issues/2524)) ([73705c2](https://github.com/googleapis/google-api-php-client/commit/73705c2a65bfc01fa6d7717b7f401b8288fe0587))
## [2.15.1](https://github.com/googleapis/google-api-php-client/compare/v2.15.0...v2.15.1) (2023-09-12)
### Bug Fixes
* Upgrade min phpseclib version ([#2499](https://github.com/googleapis/google-api-php-client/issues/2499)) ([8e7fae2](https://github.com/googleapis/google-api-php-client/commit/8e7fae2b79cfc1b72026347abf6314d91442a018))
## [2.15.0](https://github.com/googleapis/google-api-php-client/compare/v2.14.0...v2.15.0) (2023-05-18)
### Features
* Add pkce support and upgrade examples ([#2438](https://github.com/googleapis/google-api-php-client/issues/2438)) ([bded223](https://github.com/googleapis/google-api-php-client/commit/bded223ece445a6130cde82417b20180b1d6698a))
* Drop support for 7.3 and below ([#2431](https://github.com/googleapis/google-api-php-client/issues/2431)) ([c765b37](https://github.com/googleapis/google-api-php-client/commit/c765b379e95ab272b6a87aa802d9f5507eaeb2e7))
## [2.14.0](https://github.com/googleapis/google-api-php-client/compare/v2.13.2...v2.14.0) (2023-05-11)
### Features
* User-supplied query params for auth url ([#2432](https://github.com/googleapis/google-api-php-client/issues/2432)) ([74a7d7b](https://github.com/googleapis/google-api-php-client/commit/74a7d7b838acb08afc02b449f338fbe6577cb03c))
## [2.13.2](https://github.com/googleapis/google-api-php-client/compare/v2.13.1...v2.13.2) (2023-03-23)
### Bug Fixes
* Calling class_exists with null in Google\Model ([#2405](https://github.com/googleapis/google-api-php-client/issues/2405)) ([5ed4edc](https://github.com/googleapis/google-api-php-client/commit/5ed4edc9315110a715e9763d27ee6761e1aaa00a))
## [2.13.1](https://github.com/googleapis/google-api-php-client/compare/v2.13.0...v2.13.1) (2023-03-13)
### Bug Fixes
* Allow dynamic properties on model classes ([#2408](https://github.com/googleapis/google-api-php-client/issues/2408)) ([11080d5](https://github.com/googleapis/google-api-php-client/commit/11080d5e85a040751a13aca8131f93c7d910db11))
## [2.13.0](https://github.com/googleapis/google-api-php-client/compare/v2.12.6...v2.13.0) (2022-12-19)
### Features
* Make auth http client config extends from default client config ([#2348](https://github.com/googleapis/google-api-php-client/issues/2348)) ([2640250](https://github.com/googleapis/google-api-php-client/commit/2640250c7bab479f378972733dcc0a3e9b2e14f8))
### Bug Fixes
* Don't send content-type header if no post body exists ([#2288](https://github.com/googleapis/google-api-php-client/issues/2288)) ([654c0e2](https://github.com/googleapis/google-api-php-client/commit/654c0e29ab78aba8bfef52fd3d06a3b2b39c4e0d))
* Ensure new redirect_uri propogates to OAuth2 class ([#2282](https://github.com/googleapis/google-api-php-client/issues/2282)) ([a69131b](https://github.com/googleapis/google-api-php-client/commit/a69131b6488735d112a529a278cfc8b875e18647))
* Lint errors ([#2315](https://github.com/googleapis/google-api-php-client/issues/2315)) ([88cc63c](https://github.com/googleapis/google-api-php-client/commit/88cc63c38b0cf88629f66fdf8ba6006f6c6d5a2c))
* Update accounts.google.com authorization URI ([#2275](https://github.com/googleapis/google-api-php-client/issues/2275)) ([b2624d2](https://github.com/googleapis/google-api-php-client/commit/b2624d21fce894126b9975a872cf5cda8038b254))
================================================
FILE: lib/Google/CODE_OF_CONDUCT.md
================================================
# Contributor Code of Conduct
As contributors and maintainers of this project,
and in the interest of fostering an open and welcoming community,
we pledge to respect all people who contribute through reporting issues,
posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.
We are committed to making participation in this project
a harassment-free experience for everyone,
regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information,
such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct.
By adopting this Code of Conduct,
project maintainers commit themselves to fairly and consistently
applying these principles to every aspect of managing this project.
Project maintainers who do not follow or enforce the Code of Conduct
may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior
may be reported by opening an issue
or contacting one or more of the project maintainers.
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
================================================
FILE: lib/Google/LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: lib/Google/README.md
================================================

# Google APIs Client Library for PHP #
**NOTE**: please check to see if the package you'd like to install is available in our
list of [Google cloud packages](https://cloud.google.com/php/docs/reference) first, as
these are the recommended libraries.
- Reference Docs
- https://googleapis.github.io/google-api-php-client/
- License
- Apache 2.0
The Google API Client Library enables you to work with Google APIs such as Gmail, Drive or YouTube on your server.
These client libraries are officially supported by Google. However, the libraries are considered complete and are in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.
## Google Cloud Platform
For Google Cloud Platform APIs such as [Datastore][cloud-datastore], [Cloud Storage][cloud-storage], [Pub/Sub][cloud-pubsub], and [Compute Engine][cloud-compute], we recommend using the Google Cloud client libraries. For a complete list of supported Google Cloud client libraries, see [googleapis/google-cloud-php](https://github.com/googleapis/google-cloud-php).
[cloud-datastore]: https://github.com/googleapis/google-cloud-php-datastore
[cloud-pubsub]: https://github.com/googleapis/google-cloud-php-pubsub
[cloud-storage]: https://github.com/googleapis/google-cloud-php-storage
[cloud-compute]: https://github.com/googleapis/google-cloud-php-compute
## Requirements ##
* [PHP 8.0 or higher](https://www.php.net/)
## Developer Documentation ##
The [docs folder](docs/) provides detailed guides for using this library.
## Installation ##
You can use **Composer** or simply **Download the Release**
### Composer
The preferred method is via [composer](https://getcomposer.org/). Follow the
[installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have
composer installed.
Once composer is installed, execute the following command in your project root to install this library:
```sh
composer require google/apiclient
```
If you're facing a timeout error then either increase the timeout for composer by adding the env flag as `COMPOSER_PROCESS_TIMEOUT=600 composer install` or you can put this in the `config` section of the composer schema:
```
{
"config": {
"process-timeout": 600
}
}
```
Finally, be sure to include the autoloader:
```php
require_once '/path/to/your-project/vendor/autoload.php';
```
This library relies on `google/apiclient-services`. That library provides up-to-date API wrappers for a large number of Google APIs. In order that users may make use of the latest API clients, this library does not pin to a specific version of `google/apiclient-services`. **In order to prevent the accidental installation of API wrappers with breaking changes**, it is highly recommended that you pin to the [latest version](https://github.com/googleapis/google-api-php-client-services/releases) yourself prior to using this library in production.
#### Cleaning up unused services
There are over 200 Google API services. The chances are good that you will not
want them all. In order to avoid shipping these dependencies with your code,
you can run the `Google\Task\Composer::cleanup` task and specify the services
you want to keep in `composer.json`:
```json
{
"require": {
"google/apiclient": "^2.15.0"
},
"scripts": {
"pre-autoload-dump": "Google\\Task\\Composer::cleanup"
},
"extra": {
"google/apiclient-services": [
"Drive",
"YouTube"
]
}
}
```
This example will remove all services other than "Drive" and "YouTube" when
`composer update` or a fresh `composer install` is run.
**IMPORTANT**: If you add any services back in `composer.json`, you will need to
remove the `vendor/google/apiclient-services` directory explicitly for the
change you made to have effect:
```sh
rm -r vendor/google/apiclient-services
composer update
```
**NOTE**: This command performs an exact match on the service name, so to keep
`YouTubeReporting` and `YouTubeAnalytics` as well, you'd need to add each of
them explicitly:
```json
{
"extra": {
"google/apiclient-services": [
"Drive",
"YouTube",
"YouTubeAnalytics",
"YouTubeReporting"
]
}
}
```
### Download the Release
If you prefer not to use composer, you can download the package in its entirety. The [Releases](https://github.com/googleapis/google-api-php-client/releases) page lists all stable versions. Download any file
with the name `google-api-php-client-[RELEASE_NAME].zip` for a package including this library and its dependencies.
Uncompress the zip file you download, and include the autoloader in your project:
```php
require_once '/path/to/google-api-php-client/vendor/autoload.php';
```
For additional installation and setup instructions, see [the documentation](docs/).
## Examples ##
See the [`examples/`](examples) directory for examples of the key client features. You can
view them in your browser by running the php built-in web server.
```
$ php -S localhost:8000 -t examples/
```
And then browsing to the host and port you specified
(in the above example, `http://localhost:8000`).
### Basic Example ###
```php
// include your composer dependencies
require_once 'vendor/autoload.php';
$client = new Google\Client();
$client->setApplicationName("Client_Library_Examples");
$client->setDeveloperKey("YOUR_APP_KEY");
$service = new Google\Service\Books($client);
$query = 'Henry David Thoreau';
$optParams = [
'filter' => 'free-ebooks',
];
$results = $service->volumes->listVolumes($query, $optParams);
foreach ($results->getItems() as $item) {
echo $item['volumeInfo']['title'], "
\n";
}
```
### Authentication with OAuth ###
> An example of this can be seen in [`examples/simple-file-upload.php`](examples/simple-file-upload.php).
1. Follow the instructions to [Create Web Application Credentials](docs/oauth-web.md#create-authorization-credentials)
1. Download the JSON credentials
1. Set the path to these credentials using `Google\Client::setAuthConfig`:
```php
$client = new Google\Client();
$client->setAuthConfig('/path/to/client_credentials.json');
```
1. Set the scopes required for the API you are going to call
```php
$client->addScope(Google\Service\Drive::DRIVE);
```
1. Set your application's redirect URI
```php
// Your redirect URI can be any registered URI, but in this example
// we redirect back to this same page
$redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$client->setRedirectUri($redirect_uri);
```
1. In the script handling the redirect URI, exchange the authorization code for an access token:
```php
if (isset($_GET['code'])) {
$token = $client->fetchAccessTokenWithAuthCode($_GET['code']);
}
```
### Authentication with Service Accounts ###
> An example of this can be seen in [`examples/service-account.php`](examples/service-account.php).
Some APIs
(such as the [YouTube Data API](https://developers.google.com/youtube/v3/)) do
not support service accounts. Check with the specific API documentation if API
calls return unexpected 401 or 403 errors.
1. Follow the instructions to [Create a Service Account](docs/oauth-server.md#creating-a-service-account)
1. Download the JSON credentials
1. Set the path to these credentials using the `GOOGLE_APPLICATION_CREDENTIALS` environment variable:
```php
putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json');
```
1. Tell the Google client to use your service account credentials to authenticate:
```php
$client = new Google\Client();
$client->useApplicationDefaultCredentials();
```
1. Set the scopes required for the API you are going to call
```php
$client->addScope(Google\Service\Drive::DRIVE);
```
1. If you have delegated domain-wide access to the service account and you want to impersonate a user account, specify the email address of the user account using the method setSubject:
```php
$client->setSubject($user_to_impersonate);
```
#### How to use a specific JSON key
If you want to a specific JSON key instead of using `GOOGLE_APPLICATION_CREDENTIALS` environment variable, you can do this:
```php
$jsonKey = [
'type' => 'service_account',
// ...
];
$client = new Google\Client();
$client->setAuthConfig($jsonKey);
```
### Making Requests ###
The classes used to call the API in [google-api-php-client-services](https://github.com/googleapis/google-api-php-client-services) are autogenerated. They map directly to the JSON requests and responses found in the [APIs Explorer](https://developers.google.com/apis-explorer/#p/).
A JSON request to the [Datastore API](https://developers.google.com/apis-explorer/#p/datastore/v1beta3/datastore.projects.runQuery) would look like this:
```
POST https://datastore.googleapis.com/v1beta3/projects/YOUR_PROJECT_ID:runQuery?key=YOUR_API_KEY
```
```json
{
"query": {
"kind": [{
"name": "Book"
}],
"order": [{
"property": {
"name": "title"
},
"direction": "descending"
}],
"limit": 10
}
}
```
Using this library, the same call would look something like this:
```php
// create the datastore service class
$datastore = new Google\Service\Datastore($client);
// build the query - this maps directly to the JSON
$query = new Google\Service\Datastore\Query([
'kind' => [
[
'name' => 'Book',
],
],
'order' => [
'property' => [
'name' => 'title',
],
'direction' => 'descending',
],
'limit' => 10,
]);
// build the request and response
$request = new Google\Service\Datastore\RunQueryRequest(['query' => $query]);
$response = $datastore->projects->runQuery('YOUR_DATASET_ID', $request);
```
However, as each property of the JSON API has a corresponding generated class, the above code could also be written like this:
```php
// create the datastore service class
$datastore = new Google\Service\Datastore($client);
// build the query
$request = new Google\Service\Datastore_RunQueryRequest();
$query = new Google\Service\Datastore\Query();
// - set the order
$order = new Google\Service\Datastore_PropertyOrder();
$order->setDirection('descending');
$property = new Google\Service\Datastore\PropertyReference();
$property->setName('title');
$order->setProperty($property);
$query->setOrder([$order]);
// - set the kinds
$kind = new Google\Service\Datastore\KindExpression();
$kind->setName('Book');
$query->setKinds([$kind]);
// - set the limit
$query->setLimit(10);
// add the query to the request and make the request
$request->setQuery($query);
$response = $datastore->projects->runQuery('YOUR_DATASET_ID', $request);
```
The method used is a matter of preference, but *it will be very difficult to use this library without first understanding the JSON syntax for the API*, so it is recommended to look at the [APIs Explorer](https://developers.google.com/apis-explorer/#p/) before using any of the services here.
### Making HTTP Requests Directly ###
If Google Authentication is desired for external applications, or a Google API is not available yet in this library, HTTP requests can be made directly.
If you are installing this client only to authenticate your own HTTP client requests, you should use [`google/auth`](https://github.com/googleapis/google-auth-library-php#call-the-apis) instead.
The `authorize` method returns an authorized [Guzzle Client](http://docs.guzzlephp.org/), so any request made using the client will contain the corresponding authorization.
```php
// create the Google client
$client = new Google\Client();
/**
* Set your method for authentication. Depending on the API, This could be
* directly with an access token, API key, or (recommended) using
* Application Default Credentials.
*/
$client->useApplicationDefaultCredentials();
$client->addScope(Google\Service\Plus::PLUS_ME);
// returns a Guzzle HTTP Client
$httpClient = $client->authorize();
// make an HTTP request
$response = $httpClient->get('https://www.googleapis.com/plus/v1/people/me');
```
### Caching ###
It is recommended to use another caching library to improve performance. This can be done by passing a [PSR-6](https://www.php-fig.org/psr/psr-6/) compatible library to the client:
```php
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
use Cache\Adapter\Filesystem\FilesystemCachePool;
$filesystemAdapter = new Local(__DIR__.'/');
$filesystem = new Filesystem($filesystemAdapter);
$cache = new FilesystemCachePool($filesystem);
$client->setCache($cache);
```
In this example we use [PHP Cache](http://www.php-cache.com/). Add this to your project with composer:
```
composer require cache/filesystem-adapter
```
### Updating Tokens ###
When using [Refresh Tokens](https://developers.google.com/identity/protocols/OAuth2InstalledApp#offline) or [Service Account Credentials](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#overview), it may be useful to perform some action when a new access token is granted. To do this, pass a callable to the `setTokenCallback` method on the client:
```php
$logger = new Monolog\Logger();
$tokenCallback = function ($cacheKey, $accessToken) use ($logger) {
$logger->debug(sprintf('new access token received at cache key %s', $cacheKey));
};
$client->setTokenCallback($tokenCallback);
```
### Debugging Your HTTP Request using Charles ###
It is often very useful to debug your API calls by viewing the raw HTTP request. This library supports the use of [Charles Web Proxy](https://www.charlesproxy.com/documentation/getting-started/). Download and run Charles, and then capture all HTTP traffic through Charles with the following code:
```php
// FOR DEBUGGING ONLY
$httpClient = new GuzzleHttp\Client([
'proxy' => 'localhost:8888', // by default, Charles runs on localhost port 8888
'verify' => false, // otherwise HTTPS requests will fail.
]);
$client = new Google\Client();
$client->setHttpClient($httpClient);
```
Now all calls made by this library will appear in the Charles UI.
One additional step is required in Charles to view SSL requests. Go to **Charles > Proxy > SSL Proxying Settings** and add the domain you'd like captured. In the case of the Google APIs, this is usually `*.googleapis.com`.
### Controlling HTTP Client Configuration Directly
Google API Client uses [Guzzle](http://docs.guzzlephp.org/) as its default HTTP client. That means that you can control your HTTP requests in the same manner you would for any application using Guzzle.
Let's say, for instance, we wished to apply a referrer to each request.
```php
use GuzzleHttp\Client;
$httpClient = new Client([
'headers' => [
'referer' => 'mysite.com'
]
]);
$client = new Google\Client();
$client->setHttpClient($httpClient);
```
Other Guzzle features such as [Handlers and Middleware](http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html) offer even more control.
### Partial Consent and Granted Scopes
When using OAuth2 3LO (e.g. you're a client requesting credentials from a 3rd
party, such as in the [simple file upload example](examples/simple-file-upload.php)),
you may want to take advantage of Partial Consent.
To allow clients to only grant certain scopes in the OAuth2 screen, pass the
querystring parameter for `enable_serial_consent` when generating the
authorization URL:
```php
$authUrl = $client->createAuthUrl($scope, ['enable_serial_consent' => 'true']);
```
Once the flow is completed, you can see which scopes were granted by calling
`getGrantedScope` on the OAuth2 object:
```php
// Space-separated string of granted scopes if it exists, otherwise null.
echo $client->getOAuth2Service()->getGrantedScope();
```
### Service Specific Examples ###
YouTube: https://github.com/youtube/api-samples/tree/master/php
## How Do I Contribute? ##
Please see the [contributing](.github/CONTRIBUTING.md) page for more information. In particular, we love pull requests - but please make sure to sign the contributor license agreement.
## Frequently Asked Questions ##
### What do I do if something isn't working? ###
For support with the library the best place to ask is via the google-api-php-client tag on StackOverflow: https://stackoverflow.com/questions/tagged/google-api-php-client
If there is a specific bug with the library, please [file an issue](https://github.com/googleapis/google-api-php-client/issues) in the GitHub issues tracker, including an example of the failing code and any specific errors retrieved. Feature requests can also be filed, as long as they are core library requests, and not-API specific: for those, refer to the documentation for the individual APIs for the best place to file requests. Please try to provide a clear statement of the problem that the feature would address.
### I want an example of X! ###
If X is a feature of the library, file away! If X is an example of using a specific service, the best place to go is to the teams for those specific APIs - our preference is to link to their examples rather than add them to the library, as they can then pin to specific versions of the library. If you have any examples for other APIs, let us know and we will happily add a link to the README above!
### Why do some Google\Service classes have weird names? ###
The _Google\Service_ classes are generally automatically generated from the API discovery documents: https://developers.google.com/discovery/. Sometimes new features are added to APIs with unusual names, which can cause some unexpected or non-standard style naming in the PHP classes.
### How do I deal with non-JSON response types? ###
Some services return XML or similar by default, rather than JSON, which is what the library supports. You can request a JSON response by adding an 'alt' argument to optional params that is normally the last argument to a method call:
```php
$opt_params = array(
'alt' => "json"
);
```
### How do I set a field to null? ###
The library strips out nulls from the objects sent to the Google APIs as it is the default value of all of the uninitialized properties. To work around this, set the field you want to null to `Google\Model::NULL_VALUE`. This is a placeholder that will be replaced with a true null when sent over the wire.
## Code Quality ##
Run the PHPUnit tests with PHPUnit. You can configure an API key and token in BaseTest.php to run all calls, but this will require some setup on the Google Developer Console.
phpunit tests/
### Coding Style
To check for coding style violations, run
```
vendor/bin/phpcs src --standard=style/ruleset.xml -np
```
To automatically fix (fixable) coding style violations, run
```
vendor/bin/phpcbf src --standard=style/ruleset.xml
```
================================================
FILE: lib/Google/SECURITY.md
================================================
# Security Policy
To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
================================================
FILE: lib/Google/UPGRADING.md
================================================
Google API Client Upgrade Guide
===============================
2.x to 2.10.0
-------------
### Namespaces
The Google API Client for PHP now uses namespaces for all classes. Code using
the legacy classnames will continue to work, but it is advised to upgrade to the
underspaced names, as the legacy classnames will be deprecated some time in the
future.
**Before**
```php
$client = new Google_Client();
$service = new Google_Service_Books($client);
```
**After**
```php
$client = new Google\Client();
$service = new Google\Service\Books($client);
```
### Service class constructors
Service class constructors now accept an optional `Google\Client|array` parameter
as their first argument, rather than requiring an instance of `Google\Client`.
**Before**
```php
$client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
$client->setDeveloperKey("YOUR_APP_KEY");
$service = new Google_Service_Books($client);
```
**After**
```php
$service = new Google\Service\Books([
'application_name' => "Client_Library_Examples",
'developer_key' => "YOUR_APP_KEY",
]);
```
1.0 to 2.0
----------
The Google API Client for PHP has undergone major internal changes in `2.0`. Please read through
the list below in order to upgrade to the latest version:
## Installation now uses `Composer`
**Before**
The project was cloned in your project and you would run the autoloader from wherever:
```php
// the autoload file was included
require_once 'google-api-php-client/src/Google/autoload.php'; // or wherever autoload.php is located
// OR classes were added one-by-one
require_once 'Google/Client.php';
require_once 'Google/Service/YouTube.php';
```
**After**
This library now uses [composer](https://getcomposer.org) (We suggest installing
composer [globally](http://symfony.com/doc/current/cookbook/composer.html)). Add this library by
running the following in the root of your project:
```
$ composer require google/apiclient:~2.0
```
This will install this library and generate an autoload file in `vendor/autoload.php` in the root
of your project. You can now include this library with the following code:
```php
require_once 'vendor/autoload.php';
```
## Access Tokens are passed around as arrays instead of JSON strings
**Before**
```php
$accessToken = $client->getAccessToken();
print_r($accessToken);
// would output:
// string(153) "{"access_token":"ya29.FAKsaByOPoddfzvKRo_LBpWWCpVTiAm4BjsvBwxtN7IgSNoUfcErBk_VPl4iAiE1ntb_","token_type":"Bearer","expires_in":3593,"created":1445548590}"
file_put_contents($credentialsPath, $accessToken);
```
**After**
```php
$accessToken = $client->getAccessToken();
print_r($accessToken);
// will output:
// array(4) {
// ["access_token"]=>
// string(73) "ya29.FAKsaByOPoddfzvKRo_LBpWWCpVTiAm4BjsvBwxtN7IgSNoUfcErBk_VPl4iAiE1ntb_"
// ["token_type"]=>
// string(6) "Bearer"
// ["expires_in"]=>
// int(3593)
// ["created"]=>
// int(1445548590)
// }
file_put_contents($credentialsPath, json_encode($accessToken));
```
## ID Token data is returned as an array
**Before**
```php
$ticket = $client->verifyIdToken($idToken);
$data = $ticket->getAttributes();
$userId = $data['payload']['sub'];
```
**After**
```php
$userData = $client->verifyIdToken($idToken);
$userId = $userData['sub'];
```
## `Google_Auth_AssertionCredentials` has been removed
For service accounts, we now use `setAuthConfig` or `useApplicationDefaultCredentials`
**Before**
```php
$client_email = '1234567890-a1b2c3d4e5f6g7h8i@developer.gserviceaccount.com';
$private_key = file_get_contents('MyProject.p12');
$scopes = array('https://www.googleapis.com/auth/sqlservice.admin');
$credentials = new Google_Auth_AssertionCredentials(
$client_email,
$scopes,
$private_key
);
```
**After**
```php
$client->setAuthConfig('/path/to/service-account.json');
// OR use environment variables (recommended)
putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json');
$client->useApplicationDefaultCredentials();
```
> Note: P12s are deprecated in favor of service account JSON, which can be generated in the
> Credentials section of Google Developer Console.
In order to impersonate a user, call `setSubject` when your service account
credentials are being used.
**Before**
```php
$user_to_impersonate = 'user@example.org';
$credentials = new Google_Auth_AssertionCredentials(
$client_email,
$scopes,
$private_key,
'notasecret', // Default P12 password
'http://oauth.net/grant_type/jwt/1.0/bearer', // Default grant type
$user_to_impersonate,
);
```
**After**
```php
$user_to_impersonate = 'user@example.org';
$client->setSubject($user_to_impersonate);
```
Additionally, `Google_Client::loadServiceAccountJson` has been removed in favor
of `Google_Client::setAuthConfig`:
**Before**
```php
$scopes = [ Google_Service_Books::BOOKS ];
$client->loadServiceAccountJson('/path/to/service-account.json', $scopes);
```
**After**
```php
$scopes = [ Google_Service_Books::BOOKS ];
$client->setAuthConfig('/path/to/service-account.json');
$client->setScopes($scopes);
```
## `Google_Auth_AppIdentity` has been removed
For App Engine authentication, we now use the underlying [`google/auth`][Google Auth] and
call `useApplicationDefaultCredentials`:
**Before**
```php
$client->setAuth(new Google_Auth_AppIdentity($client));
$client->getAuth()
->authenticateForScope('https://www.googleapis.com/auth/sqlservice.admin')
```
**After**
```php
$client->useApplicationDefaultCredentials();
$client->addScope('https://www.googleapis.com/auth/sqlservice.admin');
```
This will detect when the App Engine environment is present, and use the appropriate credentials.
## `Google_Auth_Abstract` classes have been removed
[`google/auth`][Google Auth] is now used for authentication. As a result, all
`Google_Auth`-related functionality has been removed. The methods that were a part of
`Google_Auth_Abstract` have been moved into the `Google_Client` object.
**Before**
```php
$request = new Google_Http_Request();
$client->getAuth()->sign($request);
```
**After**
```php
// create an authorized HTTP client
$httpClient = $client->authorize();
// OR add authorization to an existing client
$httpClient = new GuzzleHttp\Client();
$httpClient = $client->authorize($httpClient);
```
**Before**
```php
$request = new Google_Http_Request();
$response = $client->getAuth()->authenticatedRequest($request);
```
**After**
```php
$httpClient = $client->authorize();
$request = new GuzzleHttp\Psr7\Request('POST', $url);
$response = $httpClient->send($request);
```
> NOTE: `$request` can be any class implementing
> `Psr\Http\Message\RequestInterface`
In addition, other methods that were callable on `Google_Auth_OAuth2` are now called
on the `Google_Client` object:
**Before**
```php
$client->getAuth()->refreshToken($token);
$client->getAuth()->refreshTokenWithAssertion();
$client->getAuth()->revokeToken($token);
$client->getAuth()->isAccessTokenExpired();
```
**After**
```php
$client->refreshToken($token);
$client->refreshTokenWithAssertion();
$client->revokeToken($token);
$client->isAccessTokenExpired();
```
## PHP 5.6 is now the minimum supported PHP version
This was previously `PHP 5.2`. If you still need to use PHP 5.2, please continue to use
the [v1-master](https://github.com/google/google-api-php-client/tree/v1-master) branch.
## Guzzle and PSR-7 are used for HTTP Requests
The HTTP library Guzzle is used for all HTTP Requests. By default, [`Guzzle 6`][Guzzle 6]
is used, but this library is also compatible with [`Guzzle 5`][Guzzle 5]. As a result,
all `Google_IO`-related functionality and `Google_Http`-related functionality has been
changed or removed.
1. Removed `Google_Http_Request`
1. Removed `Google_IO_Abstract`, `Google_IO_Exception`, `Google_IO_Curl`, and `Google_IO_Stream`
1. Removed methods `Google_Client::getIo` and `Google_Client::setIo`
1. Refactored `Google_Http_Batch` and `Google_Http_MediaFileUpload` for Guzzle
1. Added `Google_Client::getHttpClient` and `Google_Client::setHttpClient` for getting and
setting the Guzzle `GuzzleHttp\ClientInterface` object.
> NOTE: `PSR-7`-compatible libraries can now be used with this library.
## Other Changes
- [`PSR 3`][PSR 3] `LoggerInterface` is now supported, and [Monolog][Monolog] is used for all
logging. As a result, all `Google_Logger`-related functionality has been removed:
1. Removed `Google_Logger_Abstract`, `Google_Logger_Exception`, `Google_Logger_File`,
`Google_Logger_Null`, and `Google_Logger_Psr`
1. `Google_Client::setLogger` now requires `Psr\Log\LoggerInterface`
- [`firebase/jwt`][Firebase JWT] is now used for all JWT signing and verifying. As a result, the
following classes have been changed or removed:
1. Removed `Google_Signer_P12`
1. Removed `Google_Verifier_Pem`
1. Removed `Google_Auth_LoginTicket` (see below)
- The following classes and methods have been removed in favor of [`google/auth`][Google Auth]:
1. Removed methods `Google_Client::getAuth` and `Google_Client::setAuth`
1. Removed `Google_Auth_Abstract`
- `Google_Auth_Abstract::sign` and `Google_Auth_Abstract::authenticatedRequest` have been
replaced by `Google_Client::authorize`. See the above examples for more details.
1. Removed `Google_Auth_AppIdentity`. This is now supported in [`google/auth`][Google Auth AppIdentity]
and is used automatically when `Google_Client::useApplicationDefaultCredentials` is called.
1. Removed `Google_Auth_AssertionCredentials`. Use `Google_Client::setAuthConfig` instead.
1. Removed `Google_Auth_ComputeEngine`. This is now supported in
[`google/auth`][Google Auth GCE], and is used automatically when
`Google_Client::useApplicationDefaultCredentials` is called.
1. Removed `Google_Auth_Exception`
1. Removed `Google_Auth_LoginTicket`. Calls to `Google_Client::verifyIdToken` now returns
the payload of the ID Token as an array if the verification is successful.
1. Removed `Google_Auth_OAuth2`. This functionality is now supported in [`google/auth`][Google Auth OAuth2] and wrapped in `Google_Client`. These changes will only affect applications calling `Google_Client::getAuth`,
as the methods on `Google_Client` have not changed.
1. Removed `Google_Auth_Simple`. This is now supported in [`google/auth`][Google Auth Simple]
and is used automatically when `Google_Client::setDeveloperKey` is called.
- `Google_Client::sign` has been replaced by `Google_Client::authorize`. This function
now takes a `GuzzleHttp\ClientInterface` object and uses the following decision tree for
authentication:
1. Uses Application Default Credentials when
`Google_Client::useApplicationDefaultCredentials` is called
- Looks for `GOOGLE_APPLICATION_CREDENTIALS` environment variable if set
- Looks in `~/.config/gcloud/application_default_credentials.json`
- Otherwise, uses `GCECredentials`
1. Uses API Key if set (see `Client::setDeveloperKey`)
1. Uses Access Token if set (call `Client::setAccessToken`)
1. Automatically refreshes access tokens if one is set and the access token is expired
- Removed `Google_Config`
- Removed `Google_Utils`
- [`PSR-6`][PSR 6] cache is used for all caching. As a result:
1. Removed `Google_Cache_Abstract`
1. Classes `Google_Cache_Apc`, `Google_Cache_File`, `Google_Cache_Memcache`, and
`Google_Cache_Null` now implement `Google\Auth\CacheInterface`.
1. Google Auth provides simple [caching utilities][Google Auth Cache] which
are used by default unless you provide alternatives.
- Removed `$boundary` constructor argument for `Google_Http_MediaFileUpload`
[PSR 3]: https://www.php-fig.org/psr/psr-3/
[PSR 6]: https://www.php-fig.org/psr/psr-6/
[Guzzle 5]: https://github.com/guzzle/guzzle
[Guzzle 6]: http://docs.guzzlephp.org/en/latest/psr7.html
[Monolog]: https://github.com/Seldaek/monolog
[Google Auth]: https://github.com/google/google-auth-library-php
[Google Auth Cache]: https://github.com/googleapis/google-auth-library-php/tree/master/src/Cache
[Google Auth GCE]: https://github.com/google/google-auth-library-php/blob/master/src/GCECredentials.php
[Google Auth OAuth2]: https://github.com/google/google-auth-library-php/blob/master/src/OAuth2.php
[Google Auth Simple]: https://github.com/google/google-auth-library-php/blob/master/src/Simple.php
[Google Auth AppIdentity]: https://github.com/google/google-auth-library-php/blob/master/src/AppIdentityCredentials.php
[Firebase JWT]: https://github.com/firebase/php-jwt
================================================
FILE: lib/Google/composer.json
================================================
{
"name": "google/apiclient",
"type": "library",
"description": "Client library for Google APIs",
"keywords": ["google"],
"homepage": "http://developers.google.com/api-client-library/php",
"license": "Apache-2.0",
"require": {
"php": "^8.1",
"google/auth": "^1.37",
"google/apiclient-services": "~0.350",
"firebase/php-jwt": "^6.0||^7.0",
"monolog/monolog": "^2.9||^3.0",
"phpseclib/phpseclib": "^3.0.36",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.6",
"google/cloud-storage": "^1.49",
"google/cloud-core": "^1.60"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.8",
"symfony/dom-crawler": "~2.1",
"symfony/css-selector": "~2.1",
"phpcompatibility/php-compatibility": "^9.2",
"composer/composer": "^2.9.3",
"phpspec/prophecy-phpunit": "^2.1",
"phpunit/phpunit": "^9.6",
"symfony/process": "^6.4"
},
"suggest": {
"cache/filesystem-adapter": "For caching certs and tokens (using Google\\Client::setCache)"
},
"autoload": {
"psr-4": {
"Google\\": "src/"
},
"files": [
"src/aliases.php"
],
"classmap": [
"src/aliases.php"
]
},
"scripts": {
"pre-autoload-dump": "Google\\Task\\Composer::cleanup"
},
"extra": {
"google/apiclient-services": [
"Storage"
],
"branch-alias": {
"dev-main": "2.x-dev"
}
}
}
================================================
FILE: lib/Google/phpstan.neon.dist
================================================
parameters:
treatPhpDocTypesAsCertain: false
level: 5
paths:
- src
================================================
FILE: lib/Google/src/AccessToken/Revoke.php
================================================
http = $http;
}
/**
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
* token, if a token isn't provided.
*
* @param string|array $token The token (access token or a refresh token) that should be revoked.
* @return boolean Returns True if the revocation was successful, otherwise False.
*/
public function revokeToken($token)
{
if (is_array($token)) {
if (isset($token['refresh_token'])) {
$token = $token['refresh_token'];
} else {
$token = $token['access_token'];
}
}
$body = Psr7\Utils::streamFor(http_build_query(['token' => $token]));
$request = new Request(
'POST',
Client::OAUTH2_REVOKE_URI,
[
'Cache-Control' => 'no-store',
'Content-Type' => 'application/x-www-form-urlencoded',
],
$body
);
$httpHandler = HttpHandlerFactory::build($this->http);
$response = $httpHandler($request);
return $response->getStatusCode() == 200;
}
}
================================================
FILE: lib/Google/src/AccessToken/Verify.php
================================================
http = $http;
$this->cache = $cache;
$this->jwt = $jwt ?: $this->getJwtService();
}
/**
* Verifies an id token and returns the authenticated apiLoginTicket.
* Throws an exception if the id token is not valid.
* The audience parameter can be used to control which id tokens are
* accepted. By default, the id token must have been issued to this OAuth2 client.
*
* @param string $idToken the ID token in JWT format
* @param string $audience Optional. The audience to verify against JWt "aud"
* @return array|false the token payload, if successful
*/
public function verifyIdToken($idToken, $audience = null)
{
if (empty($idToken)) {
throw new LogicException('id_token cannot be null');
}
// set phpseclib constants if applicable
$this->setPhpsecConstants();
// Check signature
$certs = $this->getFederatedSignOnCerts();
foreach ($certs as $cert) {
try {
$args = [$idToken];
$publicKey = $this->getPublicKey($cert);
if (class_exists(Key::class)) {
$args[] = new Key($publicKey, 'RS256');
} else {
$args[] = $publicKey;
$args[] = ['RS256'];
}
$payload = \call_user_func_array([$this->jwt, 'decode'], $args);
if (property_exists($payload, 'aud')) {
if ($audience && $payload->aud != $audience) {
return false;
}
}
// support HTTP and HTTPS issuers
// @see https://developers.google.com/identity/sign-in/web/backend-auth
$issuers = [self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS];
if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) {
return false;
}
return (array)$payload;
} catch (ExpiredException $e) { // @phpstan-ignore-line
return false;
} catch (ExpiredExceptionV3 $e) {
return false;
} catch (SignatureInvalidException $e) {
// continue
} catch (DomainException $e) {
// continue
}
}
return false;
}
private function getCache()
{
return $this->cache;
}
/**
* Retrieve and cache a certificates file.
*
* @param string $url location
* @return array certificates
* @throws \Google\Exception
*/
private function retrieveCertsFromLocation($url)
{
// If we're retrieving a local file, just grab it.
if (0 !== strpos($url, 'http')) {
if (!$file = file_get_contents($url)) {
throw new GoogleException(
"Failed to retrieve verification certificates: '".
$url."'."
);
}
return json_decode($file, true);
}
// @phpstan-ignore-next-line
$response = $this->http->get($url);
if ($response->getStatusCode() == 200) {
return json_decode((string)$response->getBody(), true);
}
throw new GoogleException(
sprintf(
'Failed to retrieve verification certificates: "%s".',
$response->getBody()->getContents()
),
$response->getStatusCode()
);
}
// Gets federated sign-on certificates to use for verifying identity tokens.
// Returns certs as array structure, where keys are key ids, and values
// are PEM encoded certificates.
private function getFederatedSignOnCerts()
{
$certs = null;
if ($cache = $this->getCache()) {
$cacheItem = $cache->getItem('federated_signon_certs_v3');
$certs = $cacheItem->get();
}
if (!$certs) {
$certs = $this->retrieveCertsFromLocation(
self::FEDERATED_SIGNON_CERT_URL
);
if ($cache) {
$cacheItem->expiresAt(new DateTime('+1 hour'));
$cacheItem->set($certs);
$cache->save($cacheItem);
}
}
if (!isset($certs['keys'])) {
throw new InvalidArgumentException(
'federated sign-on certs expects "keys" to be set'
);
}
return $certs['keys'];
}
private function getJwtService()
{
$jwt = new JWT();
if ($jwt::$leeway < 1) {
// Ensures JWT leeway is at least 1
// @see https://github.com/google/google-api-php-client/issues/827
$jwt::$leeway = 1;
}
return $jwt;
}
private function getPublicKey($cert)
{
$modulus = new BigInteger($this->jwt->urlsafeB64Decode($cert['n']), 256);
$exponent = new BigInteger($this->jwt->urlsafeB64Decode($cert['e']), 256);
$component = ['n' => $modulus, 'e' => $exponent];
$loader = PublicKeyLoader::load($component);
return $loader->toString('PKCS8');
}
/**
* phpseclib calls "phpinfo" by default, which requires special
* whitelisting in the AppEngine VM environment. This function
* sets constants to bypass the need for phpseclib to check phpinfo
*
* @see phpseclib/Math/BigInteger
* @see https://github.com/GoogleCloudPlatform/getting-started-php/issues/85
*/
private function setPhpsecConstants()
{
if (filter_var(getenv('GAE_VM'), FILTER_VALIDATE_BOOLEAN)) {
if (!defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
define('MATH_BIGINTEGER_OPENSSL_ENABLED', true);
}
if (!defined('CRYPT_RSA_MODE')) {
define('CRYPT_RSA_MODE', AES::ENGINE_OPENSSL);
}
}
}
}
================================================
FILE: lib/Google/src/AuthHandler/AuthHandlerFactory.php
================================================
cache = $cache;
$this->cacheConfig = $cacheConfig;
}
public function attachCredentials(
ClientInterface $http,
FetchAuthTokenInterface $credentials,
?callable $tokenCallback = null
) {
// use the provided cache
if ($this->cache) {
$credentials = new FetchAuthTokenCache(
$credentials,
$this->cacheConfig,
$this->cache
);
}
return $this->attachToHttp($http, $credentials, $tokenCallback);
}
public function attachCredentialsCache(
ClientInterface $http,
FetchAuthTokenCache $credentials,
?callable $tokenCallback = null
) {
return $this->attachToHttp($http, $credentials, $tokenCallback);
}
private function attachToHttp(
ClientInterface $http,
FetchAuthTokenInterface $credentials,
?callable $tokenCallback = null
) {
// if we end up needing to make an HTTP request to retrieve credentials, we
// can use our existing one, but we need to throw exceptions so the error
// bubbles up.
$authHttp = $this->createAuthHttp($http);
$authHttpHandler = HttpHandlerFactory::build($authHttp);
$middleware = new AuthTokenMiddleware(
$credentials,
$authHttpHandler,
$tokenCallback
);
$config = $http->getConfig();
$config['handler']->remove('google_auth');
$config['handler']->push($middleware, 'google_auth');
$config['auth'] = 'google_auth';
return new Client($config);
}
public function attachToken(ClientInterface $http, array $token, array $scopes)
{
$tokenFunc = function ($scopes) use ($token) {
return $token['access_token'];
};
// Derive a cache prefix from the token, to ensure setting a new token
// results in a cache-miss.
// Note: Supplying a custom "prefix" will bust this behavior.
$cacheConfig = $this->cacheConfig;
if (!isset($cacheConfig['prefix']) && isset($token['access_token'])) {
$cacheConfig['prefix'] = substr(sha1($token['access_token']), -10);
}
$middleware = new ScopedAccessTokenMiddleware(
$tokenFunc,
$scopes,
$cacheConfig,
$this->cache
);
$config = $http->getConfig();
$config['handler']->remove('google_auth');
$config['handler']->push($middleware, 'google_auth');
$config['auth'] = 'scoped';
$http = new Client($config);
return $http;
}
public function attachKey(ClientInterface $http, $key)
{
$middleware = new SimpleMiddleware(['key' => $key]);
$config = $http->getConfig();
$config['handler']->remove('google_auth');
$config['handler']->push($middleware, 'google_auth');
$config['auth'] = 'simple';
$http = new Client($config);
return $http;
}
private function createAuthHttp(ClientInterface $http)
{
return new Client(['http_errors' => true] + $http->getConfig());
}
}
================================================
FILE: lib/Google/src/AuthHandler/Guzzle7AuthHandler.php
================================================
config = array_merge([
'application_name' => '',
'base_path' => self::API_BASE_PATH,
'client_id' => '',
'client_secret' => '',
'credentials' => null,
'scopes' => null,
'quota_project' => null,
'redirect_uri' => null,
'state' => null,
'developer_key' => '',
'use_application_default_credentials' => false,
'signing_key' => null,
'signing_algorithm' => null,
'subject' => null,
'hd' => '',
'prompt' => '',
'openid.realm' => '',
'include_granted_scopes' => null,
'logger' => null,
'login_hint' => '',
'request_visible_actions' => '',
'access_type' => 'online',
'approval_prompt' => 'auto',
'retry' => [],
'retry_map' => null,
'cache' => null,
'cache_config' => [],
'token_callback' => null,
'jwt' => null,
'api_format_v2' => false,
'universe_domain' => getenv('GOOGLE_CLOUD_UNIVERSE_DOMAIN')
?: GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN,
], $config);
if (!is_null($this->config['credentials'])) {
if ($this->config['credentials'] instanceof FetchAuthTokenInterface) {
$this->credentials = $this->config['credentials'];
} else {
$this->setAuthConfig($this->config['credentials']);
}
unset($this->config['credentials']);
}
if (!is_null($this->config['scopes'])) {
$this->setScopes($this->config['scopes']);
unset($this->config['scopes']);
}
// Set a default token callback to update the in-memory access token
if (is_null($this->config['token_callback'])) {
$this->config['token_callback'] = function ($cacheKey, $newAccessToken) {
$this->setAccessToken(
[
'access_token' => $newAccessToken,
'expires_in' => 3600, // Google default
'created' => time(),
]
);
};
}
if (!is_null($this->config['cache'])) {
$this->setCache($this->config['cache']);
unset($this->config['cache']);
}
if (!is_null($this->config['logger'])) {
$this->setLogger($this->config['logger']);
unset($this->config['logger']);
}
}
/**
* Get a string containing the version of the library.
*
* @return string
*/
public function getLibraryVersion()
{
return self::LIBVER;
}
/**
* For backwards compatibility
* alias for fetchAccessTokenWithAuthCode
*
* @param string $code string code from accounts.google.com
* @return array access token
* @deprecated
*/
public function authenticate($code)
{
return $this->fetchAccessTokenWithAuthCode($code);
}
/**
* Attempt to exchange a code for an valid authentication token.
* Helper wrapped around the OAuth 2.0 implementation.
*
* @param string $code code from accounts.google.com
* @param string $codeVerifier the code verifier used for PKCE (if applicable)
* @return array access token
*/
public function fetchAccessTokenWithAuthCode($code, $codeVerifier = null)
{
if (strlen($code) == 0) {
throw new InvalidArgumentException("Invalid code");
}
$auth = $this->getOAuth2Service();
$auth->setCode($code);
$auth->setRedirectUri($this->getRedirectUri());
if ($codeVerifier) {
$auth->setCodeVerifier($codeVerifier);
}
$httpHandler = HttpHandlerFactory::build($this->getHttpClient());
$creds = $auth->fetchAuthToken($httpHandler);
if ($creds && isset($creds['access_token'])) {
$creds['created'] = time();
$this->setAccessToken($creds);
}
return $creds;
}
/**
* For backwards compatibility
* alias for fetchAccessTokenWithAssertion
*
* @return array access token
* @deprecated
*/
public function refreshTokenWithAssertion()
{
return $this->fetchAccessTokenWithAssertion();
}
/**
* Fetches a fresh access token with a given assertion token.
* @param ClientInterface $authHttp optional.
* @return array access token
*/
public function fetchAccessTokenWithAssertion(?ClientInterface $authHttp = null)
{
if (!$this->isUsingApplicationDefaultCredentials()) {
throw new DomainException(
'set the JSON service account credentials using'
. ' Google\Client::setAuthConfig or set the path to your JSON file'
. ' with the "GOOGLE_APPLICATION_CREDENTIALS" environment variable'
. ' and call Google\Client::useApplicationDefaultCredentials to'
. ' refresh a token with assertion.'
);
}
$this->getLogger()->log(
'info',
'OAuth2 access token refresh with Signed JWT assertion grants.'
);
$credentials = $this->createApplicationDefaultCredentials();
$httpHandler = HttpHandlerFactory::build($authHttp);
$creds = $credentials->fetchAuthToken($httpHandler);
if ($creds && isset($creds['access_token'])) {
$creds['created'] = time();
$this->setAccessToken($creds);
}
return $creds;
}
/**
* For backwards compatibility
* alias for fetchAccessTokenWithRefreshToken
*
* @param string $refreshToken
* @return array access token
*/
public function refreshToken($refreshToken)
{
return $this->fetchAccessTokenWithRefreshToken($refreshToken);
}
/**
* Fetches a fresh OAuth 2.0 access token with the given refresh token.
* @param string $refreshToken
* @return array access token
*/
public function fetchAccessTokenWithRefreshToken($refreshToken = null)
{
if (null === $refreshToken) {
if (!isset($this->token['refresh_token'])) {
throw new LogicException(
'refresh token must be passed in or set as part of setAccessToken'
);
}
$refreshToken = $this->token['refresh_token'];
}
$this->getLogger()->info('OAuth2 access token refresh');
$auth = $this->getOAuth2Service();
$auth->setRefreshToken($refreshToken);
$httpHandler = HttpHandlerFactory::build($this->getHttpClient());
$creds = $auth->fetchAuthToken($httpHandler);
if ($creds && isset($creds['access_token'])) {
$creds['created'] = time();
if (!isset($creds['refresh_token'])) {
$creds['refresh_token'] = $refreshToken;
}
$this->setAccessToken($creds);
}
return $creds;
}
/**
* Create a URL to obtain user authorization.
* The authorization endpoint allows the user to first
* authenticate, and then grant/deny the access request.
* @param string|array $scope The scope is expressed as an array or list of space-delimited strings.
* @param array $queryParams Querystring params to add to the authorization URL.
* @return string
*/
public function createAuthUrl($scope = null, array $queryParams = [])
{
if (empty($scope)) {
$scope = $this->prepareScopes();
}
if (is_array($scope)) {
$scope = implode(' ', $scope);
}
// only accept one of prompt or approval_prompt
$approvalPrompt = $this->config['prompt']
? null
: $this->config['approval_prompt'];
// include_granted_scopes should be string "true", string "false", or null
$includeGrantedScopes = $this->config['include_granted_scopes'] === null
? null
: var_export($this->config['include_granted_scopes'], true);
$params = array_filter([
'access_type' => $this->config['access_type'],
'approval_prompt' => $approvalPrompt,
'hd' => $this->config['hd'],
'include_granted_scopes' => $includeGrantedScopes,
'login_hint' => $this->config['login_hint'],
'openid.realm' => $this->config['openid.realm'],
'prompt' => $this->config['prompt'],
'redirect_uri' => $this->config['redirect_uri'],
'response_type' => 'code',
'scope' => $scope,
'state' => $this->config['state'],
]) + $queryParams;
// If the list of scopes contains plus.login, add request_visible_actions
// to auth URL.
$rva = $this->config['request_visible_actions'];
if (strlen($rva) > 0 && false !== strpos($scope, 'plus.login')) {
$params['request_visible_actions'] = $rva;
}
$auth = $this->getOAuth2Service();
return (string) $auth->buildFullAuthorizationUri($params);
}
/**
* Adds auth listeners to the HTTP client based on the credentials
* set in the Google API Client object
*
* @param ClientInterface $http the http client object.
* @return ClientInterface the http client object
*/
public function authorize(?ClientInterface $http = null)
{
$http = $http ?: $this->getHttpClient();
$authHandler = $this->getAuthHandler();
// These conditionals represent the decision tree for authentication
// 1. Check if an instance of Google\Auth\FetchAuthTokenInterface has
// been supplied via the "credentials" option
// 2. Check for Application Default Credentials
// 3a. Check for an Access Token
// 3b. If access token exists but is expired, try to refresh it
// 4. Check for API Key
if ($this->credentials) {
$this->checkUniverseDomain($this->credentials);
return $authHandler->attachCredentials(
$http,
$this->credentials,
$this->config['token_callback']
);
}
if ($this->isUsingApplicationDefaultCredentials()) {
$credentials = $this->createApplicationDefaultCredentials();
$this->checkUniverseDomain($credentials);
return $authHandler->attachCredentialsCache(
$http,
$credentials,
$this->config['token_callback']
);
}
if ($token = $this->getAccessToken()) {
$scopes = $this->prepareScopes();
// add refresh subscriber to request a new token
if (isset($token['refresh_token']) && $this->isAccessTokenExpired()) {
$credentials = $this->createUserRefreshCredentials(
$scopes,
$token['refresh_token']
);
$this->checkUniverseDomain($credentials);
return $authHandler->attachCredentials(
$http,
$credentials,
$this->config['token_callback']
);
}
return $authHandler->attachToken($http, $token, (array) $scopes);
}
if ($key = $this->config['developer_key']) {
return $authHandler->attachKey($http, $key);
}
return $http;
}
/**
* Set the configuration to use application default credentials for
* authentication
*
* @see https://developers.google.com/identity/protocols/application-default-credentials
* @param boolean $useAppCreds
*/
public function useApplicationDefaultCredentials($useAppCreds = true)
{
$this->config['use_application_default_credentials'] = $useAppCreds;
}
/**
* To prevent useApplicationDefaultCredentials from inappropriately being
* called in a conditional
*
* @see https://developers.google.com/identity/protocols/application-default-credentials
*/
public function isUsingApplicationDefaultCredentials()
{
return $this->config['use_application_default_credentials'];
}
/**
* Set the access token used for requests.
*
* Note that at the time requests are sent, tokens are cached. A token will be
* cached for each combination of service and authentication scopes. If a
* cache pool is not provided, creating a new instance of the client will
* allow modification of access tokens. If a persistent cache pool is
* provided, in order to change the access token, you must clear the cached
* token by calling `$client->getCache()->clear()`. (Use caution in this case,
* as calling `clear()` will remove all cache items, including any items not
* related to Google API PHP Client.)
*
* **NOTE:** The universe domain is assumed to be "googleapis.com" unless
* explicitly set. When setting an access token directly via this method, there
* is no way to verify the universe domain. Be sure to set the "universe_domain"
* option if "googleapis.com" is not intended.
*
* @param string|array $token
* @throws InvalidArgumentException
*/
public function setAccessToken($token)
{
if (is_string($token)) {
if ($json = json_decode($token, true)) {
$token = $json;
} else {
// assume $token is just the token string
$token = [
'access_token' => $token,
];
}
}
if ($token == null) {
throw new InvalidArgumentException('invalid json token');
}
if (!isset($token['access_token'])) {
throw new InvalidArgumentException("Invalid token format");
}
$this->token = $token;
}
public function getAccessToken()
{
return $this->token;
}
/**
* @return string|null
*/
public function getRefreshToken()
{
if (isset($this->token['refresh_token'])) {
return $this->token['refresh_token'];
}
return null;
}
/**
* Returns if the access_token is expired.
* @return bool Returns True if the access_token is expired.
*/
public function isAccessTokenExpired()
{
if (!$this->token) {
return true;
}
$created = 0;
if (isset($this->token['created'])) {
$created = $this->token['created'];
} elseif (isset($this->token['id_token'])) {
// check the ID token for "iat"
// signature verification is not required here, as we are just
// using this for convenience to save a round trip request
// to the Google API server
$idToken = $this->token['id_token'];
if (substr_count($idToken, '.') == 2) {
$parts = explode('.', $idToken);
$payload = json_decode(base64_decode($parts[1]), true);
if ($payload && isset($payload['iat'])) {
$created = $payload['iat'];
}
}
}
if (!isset($this->token['expires_in'])) {
// if the token does not have an "expires_in", then it's considered expired
return true;
}
// If the token is set to expire in the next 30 seconds.
return ($created + ($this->token['expires_in'] - 30)) < time();
}
/**
* @deprecated See UPGRADING.md for more information
*/
public function getAuth()
{
throw new BadMethodCallException(
'This function no longer exists. See UPGRADING.md for more information'
);
}
/**
* @deprecated See UPGRADING.md for more information
*/
public function setAuth($auth)
{
throw new BadMethodCallException(
'This function no longer exists. See UPGRADING.md for more information'
);
}
/**
* Set the OAuth 2.0 Client ID.
* @param string $clientId
*/
public function setClientId($clientId)
{
$this->config['client_id'] = $clientId;
}
public function getClientId()
{
return $this->config['client_id'];
}
/**
* Set the OAuth 2.0 Client Secret.
* @param string $clientSecret
*/
public function setClientSecret($clientSecret)
{
$this->config['client_secret'] = $clientSecret;
}
public function getClientSecret()
{
return $this->config['client_secret'];
}
/**
* Set the OAuth 2.0 Redirect URI.
* @param string $redirectUri
*/
public function setRedirectUri($redirectUri)
{
$this->config['redirect_uri'] = $redirectUri;
}
public function getRedirectUri()
{
return $this->config['redirect_uri'];
}
/**
* Set OAuth 2.0 "state" parameter to achieve per-request customization.
* @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
* @param string $state
*/
public function setState($state)
{
$this->config['state'] = $state;
}
/**
* @param string $accessType Possible values for access_type include:
* {@code "offline"} to request offline access from the user.
* {@code "online"} to request online access from the user.
*/
public function setAccessType($accessType)
{
$this->config['access_type'] = $accessType;
}
/**
* @param string $approvalPrompt Possible values for approval_prompt include:
* {@code "force"} to force the approval UI to appear.
* {@code "auto"} to request auto-approval when possible. (This is the default value)
*/
public function setApprovalPrompt($approvalPrompt)
{
$this->config['approval_prompt'] = $approvalPrompt;
}
/**
* Set the login hint, email address or sub id.
* @param string $loginHint
*/
public function setLoginHint($loginHint)
{
$this->config['login_hint'] = $loginHint;
}
/**
* Set the application name, this is included in the User-Agent HTTP header.
* @param string $applicationName
*/
public function setApplicationName($applicationName)
{
$this->config['application_name'] = $applicationName;
}
/**
* If 'plus.login' is included in the list of requested scopes, you can use
* this method to define types of app activities that your app will write.
* You can find a list of available types here:
* @link https://developers.google.com/+/api/moment-types
*
* @param array $requestVisibleActions Array of app activity types
*/
public function setRequestVisibleActions($requestVisibleActions)
{
if (is_array($requestVisibleActions)) {
$requestVisibleActions = implode(" ", $requestVisibleActions);
}
$this->config['request_visible_actions'] = $requestVisibleActions;
}
/**
* Set the developer key to use, these are obtained through the API Console.
* @see http://code.google.com/apis/console-help/#generatingdevkeys
* @param string $developerKey
*/
public function setDeveloperKey($developerKey)
{
$this->config['developer_key'] = $developerKey;
}
/**
* Set the hd (hosted domain) parameter streamlines the login process for
* Google Apps hosted accounts. By including the domain of the user, you
* restrict sign-in to accounts at that domain.
* @param string $hd the domain to use.
*/
public function setHostedDomain($hd)
{
$this->config['hd'] = $hd;
}
/**
* Set the prompt hint. Valid values are none, consent and select_account.
* If no value is specified and the user has not previously authorized
* access, then the user is shown a consent screen.
* @param string $prompt
* {@code "none"} Do not display any authentication or consent screens. Must not be specified with other values.
* {@code "consent"} Prompt the user for consent.
* {@code "select_account"} Prompt the user to select an account.
*/
public function setPrompt($prompt)
{
$this->config['prompt'] = $prompt;
}
/**
* openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
* 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
* an authentication request is valid.
* @param string $realm the URL-space to use.
*/
public function setOpenidRealm($realm)
{
$this->config['openid.realm'] = $realm;
}
/**
* If this is provided with the value true, and the authorization request is
* granted, the authorization will include any previous authorizations
* granted to this user/application combination for other scopes.
* @param bool $include the URL-space to use.
*/
public function setIncludeGrantedScopes($include)
{
$this->config['include_granted_scopes'] = $include;
}
/**
* sets function to be called when an access token is fetched
* @param callable $tokenCallback - function ($cacheKey, $accessToken)
*/
public function setTokenCallback(callable $tokenCallback)
{
$this->config['token_callback'] = $tokenCallback;
}
/**
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
* token, if a token isn't provided.
*
* @param string|array|null $token The token (access token or a refresh token) that should be revoked.
* @return boolean Returns True if the revocation was successful, otherwise False.
*/
public function revokeToken($token = null)
{
$tokenRevoker = new Revoke($this->getHttpClient());
return $tokenRevoker->revokeToken($token ?: $this->getAccessToken());
}
/**
* Verify an id_token. This method will verify the current id_token, if one
* isn't provided.
*
* @throws LogicException If no token was provided and no token was set using `setAccessToken`.
* @throws UnexpectedValueException If the token is not a valid JWT.
* @param string|null $idToken The token (id_token) that should be verified.
* @return array|false Returns the token payload as an array if the verification was
* successful, false otherwise.
*/
public function verifyIdToken($idToken = null)
{
$tokenVerifier = new Verify(
$this->getHttpClient(),
$this->getCache(),
$this->config['jwt']
);
if (null === $idToken) {
$token = $this->getAccessToken();
if (!isset($token['id_token'])) {
throw new LogicException(
'id_token must be passed in or set as part of setAccessToken'
);
}
$idToken = $token['id_token'];
}
return $tokenVerifier->verifyIdToken(
$idToken,
$this->getClientId()
);
}
/**
* Set the scopes to be requested. Must be called before createAuthUrl().
* Will remove any previously configured scopes.
* @param string|array $scope_or_scopes, ie:
* array(
* 'https://www.googleapis.com/auth/plus.login',
* 'https://www.googleapis.com/auth/moderator'
* );
*/
public function setScopes($scope_or_scopes)
{
$this->requestedScopes = [];
$this->addScope($scope_or_scopes);
}
/**
* This functions adds a scope to be requested as part of the OAuth2.0 flow.
* Will append any scopes not previously requested to the scope parameter.
* A single string will be treated as a scope to request. An array of strings
* will each be appended.
* @param string|string[] $scope_or_scopes e.g. "profile"
*/
public function addScope($scope_or_scopes)
{
if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
$this->requestedScopes[] = $scope_or_scopes;
} elseif (is_array($scope_or_scopes)) {
foreach ($scope_or_scopes as $scope) {
$this->addScope($scope);
}
}
}
/**
* Returns the list of scopes requested by the client
* @return array the list of scopes
*
*/
public function getScopes()
{
return $this->requestedScopes;
}
/**
* @return string|null
* @visible For Testing
*/
public function prepareScopes()
{
if (empty($this->requestedScopes)) {
return null;
}
return implode(' ', $this->requestedScopes);
}
/**
* Helper method to execute deferred HTTP requests.
*
* @template T
* @param RequestInterface $request
* @param class-string|false|null $expectedClass
* @throws \Google\Exception
* @return mixed|T|ResponseInterface
*/
public function execute(RequestInterface $request, $expectedClass = null)
{
$request = $request
->withHeader(
'User-Agent',
sprintf(
'%s %s%s',
$this->config['application_name'],
self::USER_AGENT_SUFFIX,
$this->getLibraryVersion()
)
)
->withHeader(
'x-goog-api-client',
sprintf(
'gl-php/%s gdcl/%s',
phpversion(),
$this->getLibraryVersion()
)
);
if ($this->config['api_format_v2']) {
$request = $request->withHeader(
'X-GOOG-API-FORMAT-VERSION',
'2'
);
}
// call the authorize method
// this is where most of the grunt work is done
$http = $this->authorize();
return REST::execute(
$http,
$request,
$expectedClass,
$this->config['retry'],
$this->config['retry_map']
);
}
/**
* Declare whether batch calls should be used. This may increase throughput
* by making multiple requests in one connection.
*
* @param boolean $useBatch True if the batch support should
* be enabled. Defaults to False.
*/
public function setUseBatch($useBatch)
{
// This is actually an alias for setDefer.
$this->setDefer($useBatch);
}
/**
* Are we running in Google AppEngine?
* return bool
*/
public function isAppEngine()
{
return (isset($_SERVER['SERVER_SOFTWARE']) &&
strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false);
}
public function setConfig($name, $value)
{
$this->config[$name] = $value;
}
public function getConfig($name, $default = null)
{
return isset($this->config[$name]) ? $this->config[$name] : $default;
}
/**
* For backwards compatibility
* alias for setAuthConfig
*
* @param string $file the configuration file
* @throws \Google\Exception
* @deprecated
*/
public function setAuthConfigFile($file)
{
$this->setAuthConfig($file);
}
/**
* Set the auth config from new or deprecated JSON config.
* This structure should match the file downloaded from
* the "Download JSON" button on in the Google Developer
* Console.
* @param string|array $config the configuration json
* @throws \Google\Exception
*/
public function setAuthConfig($config)
{
if (is_string($config)) {
if (!file_exists($config)) {
throw new InvalidArgumentException(sprintf('file "%s" does not exist', $config));
}
$json = file_get_contents($config);
if (!$config = json_decode($json, true)) {
throw new LogicException('invalid json for auth config');
}
}
$key = isset($config['installed']) ? 'installed' : 'web';
if (isset($config['type']) && $config['type'] == 'service_account') {
// @TODO(v3): Remove this, as it isn't accurate. ADC applies only to determining
// credentials based on the user's environment.
$this->useApplicationDefaultCredentials();
// set the information from the config
$this->setClientId($config['client_id']);
$this->config['client_email'] = $config['client_email'];
$this->config['signing_key'] = $config['private_key'];
$this->config['signing_algorithm'] = 'HS256';
} elseif (isset($config[$key])) {
// old-style
$this->setClientId($config[$key]['client_id']);
$this->setClientSecret($config[$key]['client_secret']);
if (isset($config[$key]['redirect_uris'])) {
$this->setRedirectUri($config[$key]['redirect_uris'][0]);
}
} else {
// new-style
$this->setClientId($config['client_id']);
$this->setClientSecret($config['client_secret']);
if (isset($config['redirect_uris'])) {
$this->setRedirectUri($config['redirect_uris'][0]);
}
}
}
/**
* Use when the service account has been delegated domain wide access.
*
* @param string $subject an email address account to impersonate
*/
public function setSubject($subject)
{
$this->config['subject'] = $subject;
}
/**
* Declare whether making API calls should make the call immediately, or
* return a request which can be called with ->execute();
*
* @param boolean $defer True if calls should not be executed right away.
*/
public function setDefer($defer)
{
$this->deferExecution = $defer;
}
/**
* Whether or not to return raw requests
* @return boolean
*/
public function shouldDefer()
{
return $this->deferExecution;
}
/**
* @return OAuth2 implementation
*/
public function getOAuth2Service()
{
if (!isset($this->auth)) {
$this->auth = $this->createOAuth2Service();
}
return $this->auth;
}
/**
* create a default google auth object
*/
protected function createOAuth2Service()
{
$auth = new OAuth2([
'clientId' => $this->getClientId(),
'clientSecret' => $this->getClientSecret(),
'authorizationUri' => self::OAUTH2_AUTH_URL,
'tokenCredentialUri' => self::OAUTH2_TOKEN_URI,
'redirectUri' => $this->getRedirectUri(),
'issuer' => $this->config['client_id'],
'signingKey' => $this->config['signing_key'],
'signingAlgorithm' => $this->config['signing_algorithm'],
]);
return $auth;
}
/**
* Set the Cache object
* @param CacheItemPoolInterface $cache
*/
public function setCache(CacheItemPoolInterface $cache)
{
$this->cache = $cache;
}
/**
* @return CacheItemPoolInterface
*/
public function getCache()
{
if (!$this->cache) {
$this->cache = $this->createDefaultCache();
}
return $this->cache;
}
/**
* @param array $cacheConfig
*/
public function setCacheConfig(array $cacheConfig)
{
$this->config['cache_config'] = $cacheConfig;
}
/**
* Set the Logger object
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* @return LoggerInterface
*/
public function getLogger()
{
if (!isset($this->logger)) {
$this->logger = $this->createDefaultLogger();
}
return $this->logger;
}
protected function createDefaultLogger()
{
$logger = new Logger('google-api-php-client');
if ($this->isAppEngine()) {
$handler = new MonologSyslogHandler('app', LOG_USER, Logger::NOTICE);
} else {
$handler = new MonologStreamHandler('php://stderr', Logger::NOTICE);
}
$logger->pushHandler($handler);
return $logger;
}
protected function createDefaultCache()
{
return new MemoryCacheItemPool();
}
/**
* Set the Http Client object
* @param ClientInterface $http
*/
public function setHttpClient(ClientInterface $http)
{
$this->http = $http;
}
/**
* @return ClientInterface
*/
public function getHttpClient()
{
if (null === $this->http) {
$this->http = $this->createDefaultHttpClient();
}
return $this->http;
}
/**
* Set the API format version.
*
* `true` will use V2, which may return more useful error messages.
*
* @param bool $value
*/
public function setApiFormatV2($value)
{
$this->config['api_format_v2'] = (bool) $value;
}
protected function createDefaultHttpClient()
{
$guzzleVersion = null;
if (defined('\GuzzleHttp\ClientInterface::MAJOR_VERSION')) {
$guzzleVersion = ClientInterface::MAJOR_VERSION;
} elseif (defined('\GuzzleHttp\ClientInterface::VERSION')) {
$guzzleVersion = (int)substr(ClientInterface::VERSION, 0, 1);
}
if (5 === $guzzleVersion) {
$options = [
'base_url' => $this->config['base_path'],
'defaults' => ['exceptions' => false],
];
if ($this->isAppEngine()) {
if (class_exists(StreamHandler::class)) {
// set StreamHandler on AppEngine by default
$options['handler'] = new StreamHandler();
$options['defaults']['verify'] = '/etc/ca-certificates.crt';
}
}
} elseif (6 === $guzzleVersion || 7 === $guzzleVersion) {
// guzzle 6 or 7
$options = [
'base_uri' => $this->config['base_path'],
'http_errors' => false,
];
} else {
throw new LogicException('Could not find supported version of Guzzle.');
}
return new GuzzleClient($options);
}
/**
* @return FetchAuthTokenCache
*/
private function createApplicationDefaultCredentials()
{
$scopes = $this->prepareScopes();
$sub = $this->config['subject'];
$signingKey = $this->config['signing_key'];
// create credentials using values supplied in setAuthConfig
if ($signingKey) {
$serviceAccountCredentials = [
'client_id' => $this->config['client_id'],
'client_email' => $this->config['client_email'],
'private_key' => $signingKey,
'type' => 'service_account',
'quota_project_id' => $this->config['quota_project'],
];
$credentials = CredentialsLoader::makeCredentials(
$scopes,
$serviceAccountCredentials
);
} else {
// When $sub is provided, we cannot pass cache classes to ::getCredentials
// because FetchAuthTokenCache::setSub does not exist.
// The result is when $sub is provided, calls to ::onGce are not cached.
$credentials = ApplicationDefaultCredentials::getCredentials(
$scopes,
null,
$sub ? null : $this->config['cache_config'],
$sub ? null : $this->getCache(),
$this->config['quota_project']
);
}
// for service account domain-wide authority (impersonating a user)
// @see https://developers.google.com/identity/protocols/OAuth2ServiceAccount
if ($sub) {
if (!$credentials instanceof ServiceAccountCredentials) {
throw new DomainException('domain-wide authority requires service account credentials');
}
$credentials->setSub($sub);
}
// If we are not using FetchAuthTokenCache yet, create it now
if (!$credentials instanceof FetchAuthTokenCache) {
$credentials = new FetchAuthTokenCache(
$credentials,
$this->config['cache_config'],
$this->getCache()
);
}
return $credentials;
}
protected function getAuthHandler()
{
// Be very careful using the cache, as the underlying auth library's cache
// implementation is naive, and the cache keys do not account for user
// sessions.
//
// @see https://github.com/google/google-api-php-client/issues/821
return AuthHandlerFactory::build(
$this->getCache(),
$this->config['cache_config']
);
}
private function createUserRefreshCredentials($scope, $refreshToken)
{
$creds = array_filter([
'client_id' => $this->getClientId(),
'client_secret' => $this->getClientSecret(),
'refresh_token' => $refreshToken,
]);
return new UserRefreshCredentials($scope, $creds);
}
private function checkUniverseDomain($credentials)
{
$credentialsUniverse = $credentials instanceof GetUniverseDomainInterface
? $credentials->getUniverseDomain()
: GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN;
if ($credentialsUniverse !== $this->getUniverseDomain()) {
throw new DomainException(sprintf(
'The configured universe domain (%s) does not match the credential universe domain (%s)',
$this->getUniverseDomain(),
$credentialsUniverse
));
}
}
public function getUniverseDomain()
{
return $this->config['universe_domain'];
}
}
================================================
FILE: lib/Google/src/Collection.php
================================================
{$this->collection_key})
&& is_array($this->{$this->collection_key})
) {
reset($this->{$this->collection_key});
}
}
/** @return mixed */
#[\ReturnTypeWillChange]
public function current()
{
$this->coerceType($this->key());
if (is_array($this->{$this->collection_key})) {
return current($this->{$this->collection_key});
}
}
/** @return mixed */
#[\ReturnTypeWillChange]
public function key()
{
if (
isset($this->{$this->collection_key})
&& is_array($this->{$this->collection_key})
) {
return key($this->{$this->collection_key});
}
}
/** @return mixed */
#[\ReturnTypeWillChange]
public function next()
{
return next($this->{$this->collection_key});
}
/** @return bool */
#[\ReturnTypeWillChange]
public function valid()
{
$key = $this->key();
return $key !== null && $key !== false;
}
/** @return int */
#[\ReturnTypeWillChange]
public function count()
{
if (!isset($this->{$this->collection_key})) {
return 0;
}
return count($this->{$this->collection_key});
}
/** @return bool */
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
if (!is_numeric($offset)) {
return parent::offsetExists($offset);
}
return isset($this->{$this->collection_key}[$offset]);
}
/** @return mixed */
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
if (!is_numeric($offset)) {
return parent::offsetGet($offset);
}
$this->coerceType($offset);
return $this->{$this->collection_key}[$offset];
}
/** @return void */
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
if (!is_numeric($offset)) {
parent::offsetSet($offset, $value);
}
$this->{$this->collection_key}[$offset] = $value;
}
/** @return void */
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
if (!is_numeric($offset)) {
parent::offsetUnset($offset);
}
unset($this->{$this->collection_key}[$offset]);
}
private function coerceType($offset)
{
$keyType = $this->keyType($this->collection_key);
if ($keyType && !is_object($this->{$this->collection_key}[$offset])) {
$this->{$this->collection_key}[$offset] =
new $keyType($this->{$this->collection_key}[$offset]);
}
}
}
================================================
FILE: lib/Google/src/Exception.php
================================================
client = $client;
$this->boundary = $boundary ?: mt_rand();
$rootUrl = rtrim($rootUrl ?: $this->client->getConfig('base_path'), '/');
$this->rootUrl = str_replace(
'UNIVERSE_DOMAIN',
$this->client->getUniverseDomain(),
$rootUrl
);
$this->batchPath = $batchPath ?: self::BATCH_PATH;
}
public function add(RequestInterface $request, $key = false)
{
if (false == $key) {
$key = mt_rand();
}
$this->requests[$key] = $request;
}
public function execute()
{
$body = '';
$classes = [];
$batchHttpTemplate = <<requests as $key => $request) {
$firstLine = sprintf(
'%s %s HTTP/%s',
$request->getMethod(),
$request->getRequestTarget(),
$request->getProtocolVersion()
);
$content = (string) $request->getBody();
$headers = '';
foreach ($request->getHeaders() as $name => $values) {
$headers .= sprintf("%s:%s\r\n", $name, implode(', ', $values));
}
$body .= sprintf(
$batchHttpTemplate,
$this->boundary,
$key,
$firstLine,
$headers,
$content ? "\n" . $content : ''
);
$classes['response-' . $key] = $request->getHeaderLine('X-Php-Expected-Class');
}
$body .= "--{$this->boundary}--";
$body = trim($body);
$url = $this->rootUrl . '/' . $this->batchPath;
$headers = [
'Content-Type' => sprintf('multipart/mixed; boundary=%s', $this->boundary),
'Content-Length' => (string) strlen($body),
];
$request = new Request(
'POST',
$url,
$headers,
$body
);
$response = $this->client->execute($request);
return $this->parseResponse($response, $classes);
}
public function parseResponse(ResponseInterface $response, $classes = [])
{
$contentType = $response->getHeaderLine('content-type');
$contentType = explode(';', $contentType);
$boundary = false;
foreach ($contentType as $part) {
$part = explode('=', $part, 2);
if (isset($part[0]) && 'boundary' == trim($part[0])) {
$boundary = $part[1];
}
}
$body = (string) $response->getBody();
if (!empty($body)) {
$body = str_replace("--$boundary--", "--$boundary", $body);
$parts = explode("--$boundary", $body);
$responses = [];
$requests = array_values($this->requests);
foreach ($parts as $i => $part) {
$part = trim($part);
if (!empty($part)) {
list($rawHeaders, $part) = explode("\r\n\r\n", $part, 2);
$headers = $this->parseRawHeaders($rawHeaders);
$status = substr($part, 0, strpos($part, "\n"));
$status = explode(" ", $status);
$status = $status[1];
list($partHeaders, $partBody) = $this->parseHttpResponse($part, 0);
$response = new Response(
(int) $status,
$partHeaders,
Psr7\Utils::streamFor($partBody)
);
// Need content id.
$key = $headers['content-id'];
try {
$response = REST::decodeHttpResponse($response, $requests[$i-1]);
} catch (GoogleServiceException $e) {
// Store the exception as the response, so successful responses
// can be processed.
$response = $e;
}
$responses[$key] = $response;
}
}
return $responses;
}
return null;
}
private function parseRawHeaders($rawHeaders)
{
$headers = [];
$responseHeaderLines = explode("\r\n", $rawHeaders);
foreach ($responseHeaderLines as $headerLine) {
if ($headerLine && strpos($headerLine, ':') !== false) {
list($header, $value) = explode(': ', $headerLine, 2);
$header = strtolower($header);
if (isset($headers[$header])) {
$headers[$header] = array_merge((array)$headers[$header], (array)$value);
} else {
$headers[$header] = $value;
}
}
}
return $headers;
}
/**
* Used by the IO lib and also the batch processing.
*
* @param string $respData
* @param int $headerSize
* @return array
*/
private function parseHttpResponse($respData, $headerSize)
{
// check proxy header
foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
if (stripos($respData, $established_header) !== false) {
// existed, remove it
$respData = str_ireplace($established_header, '', $respData);
// Subtract the proxy header size unless the cURL bug prior to 7.30.0
// is present which prevented the proxy header size from being taken into
// account.
// @TODO look into this
// if (!$this->needsQuirk()) {
// $headerSize -= strlen($established_header);
// }
break;
}
}
if ($headerSize) {
$responseBody = substr($respData, $headerSize);
$responseHeaders = substr($respData, 0, $headerSize);
} else {
$responseSegments = explode("\r\n\r\n", $respData, 2);
$responseHeaders = $responseSegments[0];
$responseBody = isset($responseSegments[1]) ? $responseSegments[1] : null;
}
$responseHeaders = $this->parseRawHeaders($responseHeaders);
return [$responseHeaders, $responseBody];
}
}
================================================
FILE: lib/Google/src/Http/MediaFileUpload.php
================================================
client = $client;
$this->request = $request;
$this->mimeType = $mimeType;
$this->data = $data;
$this->resumable = $resumable;
$this->chunkSize = $chunkSize;
$this->progress = 0;
$this->process();
}
/**
* Set the size of the file that is being uploaded.
* @param int $size - int file size in bytes
*/
public function setFileSize($size)
{
$this->size = $size;
}
/**
* Return the progress on the upload
* @return int progress in bytes uploaded.
*/
public function getProgress()
{
return $this->progress;
}
/**
* Send the next part of the file to upload.
* @param string|bool $chunk Optional. The next set of bytes to send. If false will
* use $data passed at construct time.
*/
public function nextChunk($chunk = false)
{
$resumeUri = $this->getResumeUri();
if (false == $chunk) {
$chunk = substr($this->data, $this->progress, $this->chunkSize);
}
$lastBytePos = $this->progress + strlen($chunk) - 1;
$headers = [
'content-range' => "bytes $this->progress-$lastBytePos/$this->size",
'content-length' => (string) strlen($chunk),
'expect' => '',
];
$request = new Request(
'PUT',
$resumeUri,
$headers,
Psr7\Utils::streamFor($chunk)
);
return $this->makePutRequest($request);
}
/**
* Return the HTTP result code from the last call made.
* @return int code
*/
public function getHttpResultCode()
{
return $this->httpResultCode;
}
/**
* Sends a PUT-Request to google drive and parses the response,
* setting the appropiate variables from the response()
*
* @param RequestInterface $request the Request which will be send
*
* @return false|mixed false when the upload is unfinished or the decoded http response
*
*/
private function makePutRequest(RequestInterface $request)
{
$response = $this->client->execute($request);
$this->httpResultCode = $response->getStatusCode();
if (308 == $this->httpResultCode) {
// Track the amount uploaded.
$range = $response->getHeaderLine('range');
if ($range) {
$range_array = explode('-', $range);
$this->progress = ((int) $range_array[1]) + 1;
}
// Allow for changing upload URLs.
$location = $response->getHeaderLine('location');
if ($location) {
$this->resumeUri = $location;
}
// No problems, but upload not complete.
return false;
}
return REST::decodeHttpResponse($response, $this->request);
}
/**
* Resume a previously unfinished upload
* @param string $resumeUri the resume-URI of the unfinished, resumable upload.
*/
public function resume($resumeUri)
{
$this->resumeUri = $resumeUri;
$headers = [
'content-range' => "bytes */$this->size",
'content-length' => '0',
];
$httpRequest = new Request(
'PUT',
$this->resumeUri,
$headers
);
return $this->makePutRequest($httpRequest);
}
/**
* @return RequestInterface
* @visible for testing
*/
private function process()
{
$this->transformToUploadUrl();
$request = $this->request;
$postBody = '';
$contentType = false;
$meta = json_decode((string) $request->getBody(), true);
$uploadType = $this->getUploadType($meta);
$request = $request->withUri(
Uri::withQueryValue($request->getUri(), 'uploadType', $uploadType)
);
$mimeType = $this->mimeType ?: $request->getHeaderLine('content-type');
if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) {
$contentType = $mimeType;
$postBody = is_string($meta) ? $meta : json_encode($meta);
} elseif (self::UPLOAD_MEDIA_TYPE == $uploadType) {
$contentType = $mimeType;
$postBody = $this->data;
} elseif (self::UPLOAD_MULTIPART_TYPE == $uploadType) {
// This is a multipart/related upload.
$boundary = $this->boundary ?: mt_rand();
$boundary = str_replace('"', '', $boundary);
$contentType = 'multipart/related; boundary=' . $boundary;
$related = "--$boundary\r\n";
$related .= "Content-Type: application/json; charset=UTF-8\r\n";
$related .= "\r\n" . json_encode($meta) . "\r\n";
$related .= "--$boundary\r\n";
$related .= "Content-Type: $mimeType\r\n";
$related .= "Content-Transfer-Encoding: base64\r\n";
$related .= "\r\n" . base64_encode($this->data) . "\r\n";
$related .= "--$boundary--";
$postBody = $related;
}
$request = $request->withBody(Psr7\Utils::streamFor($postBody));
if ($contentType) {
$request = $request->withHeader('content-type', $contentType);
}
return $this->request = $request;
}
/**
* Valid upload types:
* - resumable (UPLOAD_RESUMABLE_TYPE)
* - media (UPLOAD_MEDIA_TYPE)
* - multipart (UPLOAD_MULTIPART_TYPE)
* @param string|false $meta
* @return string
* @visible for testing
*/
public function getUploadType($meta)
{
if ($this->resumable) {
return self::UPLOAD_RESUMABLE_TYPE;
}
if (false == $meta && $this->data) {
return self::UPLOAD_MEDIA_TYPE;
}
return self::UPLOAD_MULTIPART_TYPE;
}
public function getResumeUri()
{
if (null === $this->resumeUri) {
$this->resumeUri = $this->fetchResumeUri();
}
return $this->resumeUri;
}
private function fetchResumeUri()
{
$body = $this->request->getBody();
$headers = [
'content-type' => 'application/json; charset=UTF-8',
'content-length' => $body->getSize(),
'x-upload-content-type' => $this->mimeType,
'x-upload-content-length' => $this->size,
'expect' => '',
];
foreach ($headers as $key => $value) {
$this->request = $this->request->withHeader($key, $value);
}
$response = $this->client->execute($this->request, false);
$location = $response->getHeaderLine('location');
$code = $response->getStatusCode();
if (200 == $code && true == $location) {
return $location;
}
$message = $code;
$body = json_decode((string) $this->request->getBody(), true);
if (isset($body['error']['errors'])) {
$message .= ': ';
foreach ($body['error']['errors'] as $error) {
$message .= "{$error['domain']}, {$error['message']};";
}
$message = rtrim($message, ';');
}
$error = "Failed to start the resumable upload (HTTP {$message})";
$this->client->getLogger()->error($error);
throw new GoogleException($error);
}
private function transformToUploadUrl()
{
$parts = parse_url((string) $this->request->getUri());
if (!isset($parts['path'])) {
$parts['path'] = '';
}
$parts['path'] = '/upload' . $parts['path'];
$uri = Uri::fromParts($parts);
$this->request = $this->request->withUri($uri);
}
public function setChunkSize($chunkSize)
{
$this->chunkSize = $chunkSize;
}
public function getRequest()
{
return $this->request;
}
}
================================================
FILE: lib/Google/src/Http/REST.php
================================================
|false|null $expectedClass
* @param array $config
* @param array $retryMap
* @return mixed|T|null
* @throws \Google\Service\Exception on server side error (ie: not authenticated,
* invalid or malformed post body, invalid url)
*/
public static function execute(
ClientInterface $client,
RequestInterface $request,
$expectedClass = null,
$config = [],
$retryMap = null
) {
$runner = new Runner(
$config,
sprintf('%s %s', $request->getMethod(), (string)$request->getUri()),
[self::class, 'doExecute'],
[$client, $request, $expectedClass]
);
if (null !== $retryMap) {
$runner->setRetryMap($retryMap);
}
return $runner->run();
}
/**
* Executes a Psr\Http\Message\RequestInterface
*
* @template T
* @param ClientInterface $client
* @param RequestInterface $request
* @param class-string|false|null $expectedClass
* @return mixed|T|null
* @throws \Google\Service\Exception on server side error (ie: not authenticated,
* invalid or malformed post body, invalid url)
*/
public static function doExecute(ClientInterface $client, RequestInterface $request, $expectedClass = null)
{
try {
$httpHandler = HttpHandlerFactory::build($client);
$response = $httpHandler($request);
} catch (RequestException $e) {
// if Guzzle throws an exception, catch it and handle the response
if (!$e->hasResponse()) {
throw $e;
}
$response = $e->getResponse();
}
return self::decodeHttpResponse($response, $request, $expectedClass);
}
/**
* Decode an HTTP Response.
* @static
*
* @template T
* @param RequestInterface $response The http response to be decoded.
* @param ResponseInterface $response
* @param class-string|false|null $expectedClass
* @return mixed|T|null
* @throws \Google\Service\Exception
*/
public static function decodeHttpResponse(
ResponseInterface $response,
?RequestInterface $request = null,
$expectedClass = null
) {
$code = $response->getStatusCode();
// retry strategy
if (intVal($code) >= 400) {
// if we errored out, it should be safe to grab the response body
$body = (string)$response->getBody();
// Check if we received errors, and add those to the Exception for convenience
throw new GoogleServiceException($body, $code, null, self::getResponseErrors($body));
}
// Ensure we only pull the entire body into memory if the request is not
// of media type
$body = self::decodeBody($response, $request);
if ($expectedClass = self::determineExpectedClass($expectedClass, $request)) {
$json = json_decode($body, true);
return new $expectedClass($json);
}
return $response;
}
private static function decodeBody(ResponseInterface $response, ?RequestInterface $request = null)
{
if (self::isAltMedia($request)) {
// don't decode the body, it's probably a really long string
return '';
}
return (string)$response->getBody();
}
private static function determineExpectedClass($expectedClass, ?RequestInterface $request = null)
{
// "false" is used to explicitly prevent an expected class from being returned
if (false === $expectedClass) {
return null;
}
// if we don't have a request, we just use what's passed in
if (null === $request) {
return $expectedClass;
}
// return what we have in the request header if one was not supplied
return $expectedClass ?: $request->getHeaderLine('X-Php-Expected-Class');
}
private static function getResponseErrors($body)
{
$json = json_decode($body, true);
if (isset($json['error']['errors'])) {
return $json['error']['errors'];
}
return null;
}
private static function isAltMedia(?RequestInterface $request = null)
{
if ($request && $qs = $request->getUri()->getQuery()) {
parse_str($qs, $query);
if (isset($query['alt']) && $query['alt'] == 'media') {
return true;
}
}
return false;
}
}
================================================
FILE: lib/Google/src/Model.php
================================================
mapTypes($array);
}
$this->gapiInit();
}
/**
* Getter that handles passthrough access to the data array, and lazy object creation.
* @param string $key Property name.
* @return mixed The value if any, or null.
*/
public function __get($key)
{
$keyType = $this->keyType($key);
$keyDataType = $this->dataType($key);
if ($keyType && !isset($this->processed[$key])) {
if (isset($this->modelData[$key])) {
$val = $this->modelData[$key];
} elseif ($keyDataType == 'array' || $keyDataType == 'map') {
$val = [];
} else {
$val = null;
}
if ($this->isAssociativeArray($val)) {
if ($keyDataType && 'map' == $keyDataType) {
foreach ($val as $arrayKey => $arrayItem) {
$this->modelData[$key][$arrayKey] =
new $keyType($arrayItem);
}
} else {
$this->modelData[$key] = new $keyType($val);
}
} elseif (is_array($val)) {
$arrayObject = [];
foreach ($val as $arrayIndex => $arrayItem) {
$arrayObject[$arrayIndex] = new $keyType($arrayItem);
}
$this->modelData[$key] = $arrayObject;
}
$this->processed[$key] = true;
}
return isset($this->modelData[$key]) ? $this->modelData[$key] : null;
}
/**
* Initialize this object's properties from an array.
*
* @param array $array Used to seed this object's properties.
* @return void
*/
protected function mapTypes($array)
{
// Hard initialise simple types, lazy load more complex ones.
foreach ($array as $key => $val) {
if ($keyType = $this->keyType($key)) {
$dataType = $this->dataType($key);
if ($dataType == 'array' || $dataType == 'map') {
$this->$key = [];
foreach ($val as $itemKey => $itemVal) {
if ($itemVal instanceof $keyType) {
$this->{$key}[$itemKey] = $itemVal;
} else {
$this->{$key}[$itemKey] = new $keyType($itemVal);
}
}
} elseif ($val instanceof $keyType) {
$this->$key = $val;
} else {
$this->$key = new $keyType($val);
}
unset($array[$key]);
} elseif (property_exists($this, $key)) {
$this->$key = $val;
unset($array[$key]);
} elseif (property_exists($this, $camelKey = $this->camelCase($key))) {
// This checks if property exists as camelCase, leaving it in array as snake_case
// in case of backwards compatibility issues.
$this->$camelKey = $val;
}
}
$this->modelData = $array;
}
/**
* Blank initialiser to be used in subclasses to do post-construction initialisation - this
* avoids the need for subclasses to have to implement the variadics handling in their
* constructors.
*/
protected function gapiInit()
{
return;
}
/**
* Create a simplified object suitable for straightforward
* conversion to JSON. This is relatively expensive
* due to the usage of reflection, but shouldn't be called
* a whole lot, and is the most straightforward way to filter.
*/
public function toSimpleObject()
{
$object = new stdClass();
// Process all other data.
foreach ($this->modelData as $key => $val) {
$result = $this->getSimpleValue($val);
if ($result !== null) {
$object->$key = $this->nullPlaceholderCheck($result);
}
}
// Process all public properties.
$reflect = new ReflectionObject($this);
$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
foreach ($props as $member) {
$name = $member->getName();
$result = $this->getSimpleValue($this->$name);
if ($result !== null) {
$name = $this->getMappedName($name);
$object->$name = $this->nullPlaceholderCheck($result);
}
}
return $object;
}
/**
* Handle different types of values, primarily
* other objects and map and array data types.
*/
private function getSimpleValue($value)
{
if ($value instanceof Model) {
return $value->toSimpleObject();
} elseif (is_array($value)) {
$return = [];
foreach ($value as $key => $a_value) {
$a_value = $this->getSimpleValue($a_value);
if ($a_value !== null) {
$key = $this->getMappedName($key);
$return[$key] = $this->nullPlaceholderCheck($a_value);
}
}
return $return;
}
return $value;
}
/**
* Check whether the value is the null placeholder and return true null.
*/
private function nullPlaceholderCheck($value)
{
if ($value === self::NULL_VALUE) {
return null;
}
return $value;
}
/**
* If there is an internal name mapping, use that.
*/
private function getMappedName($key)
{
if (isset($this->internal_gapi_mappings, $this->internal_gapi_mappings[$key])) {
$key = $this->internal_gapi_mappings[$key];
}
return $key;
}
/**
* Returns true only if the array is associative.
* @param array $array
* @return bool True if the array is associative.
*/
protected function isAssociativeArray($array)
{
if (!is_array($array)) {
return false;
}
$keys = array_keys($array);
foreach ($keys as $key) {
if (is_string($key)) {
return true;
}
}
return false;
}
/**
* Verify if $obj is an array.
* @throws \Google\Exception Thrown if $obj isn't an array.
* @param array $obj Items that should be validated.
* @param string $method Method expecting an array as an argument.
*/
public function assertIsArray($obj, $method)
{
if ($obj && !is_array($obj)) {
throw new GoogleException(
"Incorrect parameter type passed to $method(). Expected an array."
);
}
}
/** @return bool */
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->$offset) || isset($this->modelData[$offset]);
}
/** @return mixed */
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return isset($this->$offset) ?
$this->$offset :
$this->__get($offset);
}
/** @return void */
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
if (property_exists($this, $offset)) {
$this->$offset = $value;
} else {
$this->modelData[$offset] = $value;
$this->processed[$offset] = true;
}
}
/** @return void */
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset($this->modelData[$offset]);
}
protected function keyType($key)
{
$keyType = $key . "Type";
// ensure keyType is a valid class
if (property_exists($this, $keyType) && $this->$keyType !== null && class_exists($this->$keyType)) {
return $this->$keyType;
}
}
protected function dataType($key)
{
$dataType = $key . "DataType";
if (property_exists($this, $dataType)) {
return $this->$dataType;
}
}
public function __isset($key)
{
return isset($this->modelData[$key]);
}
public function __unset($key)
{
unset($this->modelData[$key]);
}
/**
* Convert a string to camelCase
* @param string $value
* @return string
*/
private function camelCase($value)
{
$value = ucwords(str_replace(['-', '_'], ' ', $value));
$value = str_replace(' ', '', $value);
$value[0] = strtolower($value[0]);
return $value;
}
}
================================================
FILE: lib/Google/src/Service/Exception.php
================================================
>|null $errors List of errors returned in an HTTP
* response or null. Defaults to [].
*/
public function __construct(
$message,
$code = 0,
?Exception $previous = null,
$errors = []
) {
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
parent::__construct($message, $code, $previous);
} else {
parent::__construct($message, $code);
}
$this->errors = $errors;
}
/**
* An example of the possible errors returned.
*
* [
* {
* "domain": "global",
* "reason": "authError",
* "message": "Invalid Credentials",
* "locationType": "header",
* "location": "Authorization",
* }
* ]
*
* @return array>|null List of errors returned in an HTTP response or null.
*/
public function getErrors()
{
return $this->errors;
}
}
================================================
FILE: lib/Google/src/Service/README.md
================================================
# Google API Client Services
Google API Client Service classes have been moved to the
[google-api-php-client-services](https://github.com/google/google-api-php-client-services)
repository.
================================================
FILE: lib/Google/src/Service/Resource.php
================================================
['type' => 'string', 'location' => 'query'],
'fields' => ['type' => 'string', 'location' => 'query'],
'trace' => ['type' => 'string', 'location' => 'query'],
'userIp' => ['type' => 'string', 'location' => 'query'],
'quotaUser' => ['type' => 'string', 'location' => 'query'],
'data' => ['type' => 'string', 'location' => 'body'],
'mimeType' => ['type' => 'string', 'location' => 'header'],
'uploadType' => ['type' => 'string', 'location' => 'query'],
'mediaUpload' => ['type' => 'complex', 'location' => 'query'],
'prettyPrint' => ['type' => 'string', 'location' => 'query'],
];
/** @var string $rootUrlTemplate */
private $rootUrlTemplate;
/** @var string $apiVersion */
protected $apiVersion;
/** @var \Google\Client $client */
private $client;
/** @var string $serviceName */
private $serviceName;
/** @var string $servicePath */
private $servicePath;
/** @var string $resourceName */
private $resourceName;
/** @var array $methods */
private $methods;
public function __construct($service, $serviceName, $resourceName, $resource)
{
$this->rootUrlTemplate = $service->rootUrlTemplate ?? $service->rootUrl;
$this->client = $service->getClient();
$this->servicePath = $service->servicePath;
$this->serviceName = $serviceName;
$this->resourceName = $resourceName;
$this->methods = is_array($resource) && isset($resource['methods']) ?
$resource['methods'] :
[$resourceName => $resource];
}
/**
* TODO: This function needs simplifying.
*
* @template T
* @param string $name
* @param array $arguments
* @param class-string $expectedClass - optional, the expected class name
* @return mixed|T|ResponseInterface|RequestInterface
* @throws \Google\Exception
*/
public function call($name, $arguments, $expectedClass = null)
{
if (! isset($this->methods[$name])) {
$this->client->getLogger()->error(
'Service method unknown',
[
'service' => $this->serviceName,
'resource' => $this->resourceName,
'method' => $name
]
);
throw new GoogleException(
"Unknown function: " .
"{$this->serviceName}->{$this->resourceName}->{$name}()"
);
}
$method = $this->methods[$name];
$parameters = $arguments[0];
// postBody is a special case since it's not defined in the discovery
// document as parameter, but we abuse the param entry for storing it.
$postBody = null;
if (isset($parameters['postBody'])) {
if ($parameters['postBody'] instanceof Model) {
// In the cases the post body is an existing object, we want
// to use the smart method to create a simple object for
// for JSONification.
$parameters['postBody'] = $parameters['postBody']->toSimpleObject();
} elseif (is_object($parameters['postBody'])) {
// If the post body is another kind of object, we will try and
// wrangle it into a sensible format.
$parameters['postBody'] =
$this->convertToArrayAndStripNulls($parameters['postBody']);
}
$postBody = (array) $parameters['postBody'];
unset($parameters['postBody']);
}
// TODO: optParams here probably should have been
// handled already - this may well be redundant code.
if (isset($parameters['optParams'])) {
$optParams = $parameters['optParams'];
unset($parameters['optParams']);
$parameters = array_merge($parameters, $optParams);
}
if (!isset($method['parameters'])) {
$method['parameters'] = [];
}
$method['parameters'] = array_merge(
$this->stackParameters,
$method['parameters']
);
foreach ($parameters as $key => $val) {
if ($key != 'postBody' && !isset($method['parameters'][$key])) {
$this->client->getLogger()->error(
'Service parameter unknown',
[
'service' => $this->serviceName,
'resource' => $this->resourceName,
'method' => $name,
'parameter' => $key
]
);
throw new GoogleException("($name) unknown parameter: '$key'");
}
}
foreach ($method['parameters'] as $paramName => $paramSpec) {
if (
isset($paramSpec['required']) &&
$paramSpec['required'] &&
! isset($parameters[$paramName])
) {
$this->client->getLogger()->error(
'Service parameter missing',
[
'service' => $this->serviceName,
'resource' => $this->resourceName,
'method' => $name,
'parameter' => $paramName
]
);
throw new GoogleException("($name) missing required param: '$paramName'");
}
if (isset($parameters[$paramName])) {
$value = $parameters[$paramName];
$parameters[$paramName] = $paramSpec;
$parameters[$paramName]['value'] = $value;
unset($parameters[$paramName]['required']);
} else {
// Ensure we don't pass nulls.
unset($parameters[$paramName]);
}
}
$this->client->getLogger()->info(
'Service Call',
[
'service' => $this->serviceName,
'resource' => $this->resourceName,
'method' => $name,
'arguments' => $parameters,
]
);
// build the service uri
$url = $this->createRequestUri($method['path'], $parameters);
// NOTE: because we're creating the request by hand,
// and because the service has a rootUrl property
// the "base_uri" of the Http Client is not accounted for
$request = new Request(
$method['httpMethod'],
$url,
$postBody ? ['content-type' => 'application/json'] : [],
$postBody ? json_encode($postBody) : ''
);
// support uploads
if (isset($parameters['data'])) {
$mimeType = isset($parameters['mimeType'])
? $parameters['mimeType']['value']
: 'application/octet-stream';
$data = $parameters['data']['value'];
$upload = new MediaFileUpload($this->client, $request, $mimeType, $data);
// pull down the modified request
$request = $upload->getRequest();
}
// if this is a media type, we will return the raw response
// rather than using an expected class
if (isset($parameters['alt']) && $parameters['alt']['value'] == 'media') {
$expectedClass = null;
}
// If the class which is extending from this one contains
// an Api Version, add it to the header
if ($this->apiVersion) {
$request = $request
->withHeader('X-Goog-Api-Version', $this->apiVersion);
}
// if the client is marked for deferring, rather than
// execute the request, return the response
if ($this->client->shouldDefer()) {
// @TODO find a better way to do this
$request = $request
->withHeader('X-Php-Expected-Class', $expectedClass);
return $request;
}
return $this->client->execute($request, $expectedClass);
}
protected function convertToArrayAndStripNulls($o)
{
$o = (array) $o;
foreach ($o as $k => $v) {
if ($v === null) {
unset($o[$k]);
} elseif (is_object($v) || is_array($v)) {
$o[$k] = $this->convertToArrayAndStripNulls($o[$k]);
}
}
return $o;
}
/**
* Parse/expand request parameters and create a fully qualified
* request uri.
* @static
* @param string $restPath
* @param array $params
* @return string $requestUrl
*/
public function createRequestUri($restPath, $params)
{
// Override the default servicePath address if the $restPath use a /
if ('/' == substr($restPath, 0, 1)) {
$requestUrl = substr($restPath, 1);
} else {
$requestUrl = $this->servicePath . $restPath;
}
if ($this->rootUrlTemplate) {
// code for universe domain
$rootUrl = str_replace('UNIVERSE_DOMAIN', $this->client->getUniverseDomain(), $this->rootUrlTemplate);
// code for leading slash
if ('/' !== substr($rootUrl, -1) && '/' !== substr($requestUrl, 0, 1)) {
$requestUrl = '/' . $requestUrl;
}
$requestUrl = $rootUrl . $requestUrl;
}
$uriTemplateVars = [];
$queryVars = [];
foreach ($params as $paramName => $paramSpec) {
if ($paramSpec['type'] == 'boolean') {
$paramSpec['value'] = $paramSpec['value'] ? 'true' : 'false';
}
if ($paramSpec['location'] == 'path') {
$uriTemplateVars[$paramName] = $paramSpec['value'];
} elseif ($paramSpec['location'] == 'query') {
if (is_array($paramSpec['value'])) {
foreach ($paramSpec['value'] as $value) {
$queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($value));
}
} else {
$queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($paramSpec['value']));
}
}
}
if (count($uriTemplateVars)) {
$uriTemplateParser = new UriTemplate();
$requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
}
if (count($queryVars)) {
$requestUrl .= '?' . implode('&', $queryVars);
}
return $requestUrl;
}
}
================================================
FILE: lib/Google/src/Service.php
================================================
client = $clientOrConfig;
} elseif (is_array($clientOrConfig)) {
$this->client = new Client($clientOrConfig ?: []);
} else {
$errorMessage = 'constructor must be array or instance of Google\Client';
if (class_exists('TypeError')) {
throw new TypeError($errorMessage);
}
trigger_error($errorMessage, E_USER_ERROR);
}
}
/**
* Return the associated Google\Client class.
* @return \Google\Client
*/
public function getClient()
{
return $this->client;
}
/**
* Create a new HTTP Batch handler for this service
*
* @return Batch
*/
public function createBatch()
{
return new Batch(
$this->client,
false,
$this->rootUrlTemplate ?? $this->rootUrl,
$this->batchPath
);
}
}
================================================
FILE: lib/Google/src/Task/Composer.php
================================================
getComposer();
$extra = $composer->getPackage()->getExtra();
$servicesToKeep = $extra['google/apiclient-services'] ?? [];
if (empty($servicesToKeep)) {
return;
}
$vendorDir = $composer->getConfig()->get('vendor-dir');
$serviceDir = sprintf(
'%s/google/apiclient-services/src/Google/Service',
$vendorDir
);
if (!is_dir($serviceDir)) {
// path for google/apiclient-services >= 0.200.0
$serviceDir = sprintf(
'%s/google/apiclient-services/src',
$vendorDir
);
}
self::verifyServicesToKeep($serviceDir, $servicesToKeep);
$finder = self::getServicesToRemove($serviceDir, $servicesToKeep);
$filesystem = $filesystem ?: new Filesystem();
$servicesToRemoveCount = $finder->count();
if (0 === $servicesToRemoveCount) {
return;
}
$event->getIO()->write(
sprintf('Removing %d google services', $servicesToRemoveCount)
);
$pathsToRemove = iterator_to_array($finder);
foreach ($pathsToRemove as $pathToRemove) {
$realpath = $pathToRemove->getRealPath();
$filesystem->remove($realpath);
$filesystem->remove($realpath . '.php');
}
}
/**
* @throws InvalidArgumentException when the service doesn't exist
*/
private static function verifyServicesToKeep(
$serviceDir,
array $servicesToKeep
) {
$finder = (new Finder())
->directories()
->depth('== 0');
foreach ($servicesToKeep as $service) {
if (!preg_match('/^[a-zA-Z0-9]*$/', $service)) {
throw new InvalidArgumentException(
sprintf(
'Invalid Google service name "%s"',
$service
)
);
}
try {
$finder->in($serviceDir . '/' . $service);
} catch (InvalidArgumentException $e) {
throw new InvalidArgumentException(
sprintf(
'Google service "%s" does not exist or was removed previously',
$service
)
);
}
}
}
private static function getServicesToRemove(
$serviceDir,
array $servicesToKeep
) {
// find all files in the current directory
return (new Finder())
->directories()
->depth('== 0')
->in($serviceDir)
->exclude($servicesToKeep);
}
}
================================================
FILE: lib/Google/src/Task/Exception.php
================================================
self::TASK_RETRY_ALWAYS,
'503' => self::TASK_RETRY_ALWAYS,
'rateLimitExceeded' => self::TASK_RETRY_ALWAYS,
'userRateLimitExceeded' => self::TASK_RETRY_ALWAYS,
6 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_RESOLVE_HOST
7 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_CONNECT
28 => self::TASK_RETRY_ALWAYS, // CURLE_OPERATION_TIMEOUTED
35 => self::TASK_RETRY_ALWAYS, // CURLE_SSL_CONNECT_ERROR
52 => self::TASK_RETRY_ALWAYS, // CURLE_GOT_NOTHING
'lighthouseError' => self::TASK_RETRY_NEVER
];
/**
* Creates a new task runner with exponential backoff support.
*
* @param array $config The task runner config
* @param string $name The name of the current task (used for logging)
* @param callable $action The task to run and possibly retry
* @param array $arguments The task arguments
* @throws \Google\Task\Exception when misconfigured
*/
// @phpstan-ignore-next-line
public function __construct(
$config,
$name,
$action,
array $arguments = []
) {
if (isset($config['initial_delay'])) {
if ($config['initial_delay'] < 0) {
throw new GoogleTaskException(
'Task configuration `initial_delay` must not be negative.'
);
}
$this->delay = $config['initial_delay'];
}
if (isset($config['max_delay'])) {
if ($config['max_delay'] <= 0) {
throw new GoogleTaskException(
'Task configuration `max_delay` must be greater than 0.'
);
}
$this->maxDelay = $config['max_delay'];
}
if (isset($config['factor'])) {
if ($config['factor'] <= 0) {
throw new GoogleTaskException(
'Task configuration `factor` must be greater than 0.'
);
}
$this->factor = $config['factor'];
}
if (isset($config['jitter'])) {
if ($config['jitter'] <= 0) {
throw new GoogleTaskException(
'Task configuration `jitter` must be greater than 0.'
);
}
$this->jitter = $config['jitter'];
}
if (isset($config['retries'])) {
if ($config['retries'] < 0) {
throw new GoogleTaskException(
'Task configuration `retries` must not be negative.'
);
}
$this->maxAttempts += $config['retries'];
}
if (!is_callable($action)) {
throw new GoogleTaskException(
'Task argument `$action` must be a valid callable.'
);
}
$this->action = $action;
$this->arguments = $arguments;
}
/**
* Checks if a retry can be attempted.
*
* @return boolean
*/
public function canAttempt()
{
return $this->attempts < $this->maxAttempts;
}
/**
* Runs the task and (if applicable) automatically retries when errors occur.
*
* @return mixed
* @throws \Google\Service\Exception on failure when no retries are available.
*/
public function run()
{
while ($this->attempt()) {
try {
return call_user_func_array($this->action, $this->arguments);
} catch (GoogleServiceException $exception) {
$allowedRetries = $this->allowedRetries(
$exception->getCode(),
$exception->getErrors()
);
if (!$this->canAttempt() || !$allowedRetries) {
throw $exception;
}
if ($allowedRetries > 0) {
$this->maxAttempts = min(
$this->maxAttempts,
$this->attempts + $allowedRetries
);
}
}
}
}
/**
* Runs a task once, if possible. This is useful for bypassing the `run()`
* loop.
*
* NOTE: If this is not the first attempt, this function will sleep in
* accordance to the backoff configurations before running the task.
*
* @return boolean
*/
public function attempt()
{
if (!$this->canAttempt()) {
return false;
}
if ($this->attempts > 0) {
$this->backOff();
}
$this->attempts++;
return true;
}
/**
* Sleeps in accordance to the backoff configurations.
*/
private function backOff()
{
$delay = $this->getDelay();
usleep((int) ($delay * 1000000));
}
/**
* Gets the delay (in seconds) for the current backoff period.
*
* @return int
*/
private function getDelay()
{
$jitter = $this->getJitter();
$factor = $this->attempts > 1 ? $this->factor + $jitter : 1 + abs($jitter);
return $this->delay = min($this->maxDelay, $this->delay * $factor);
}
/**
* Gets the current jitter (random number between -$this->jitter and
* $this->jitter).
*
* @return float
*/
private function getJitter()
{
return $this->jitter * 2 * mt_rand() / mt_getrandmax() - $this->jitter;
}
/**
* Gets the number of times the associated task can be retried.
*
* NOTE: -1 is returned if the task can be retried indefinitely
*
* @return integer
*/
public function allowedRetries($code, $errors = [])
{
if (isset($this->retryMap[$code])) {
return $this->retryMap[$code];
}
if (
!empty($errors) &&
isset($errors[0]['reason'], $this->retryMap[$errors[0]['reason']])
) {
return $this->retryMap[$errors[0]['reason']];
}
return 0;
}
public function setRetryMap($retryMap)
{
$this->retryMap = $retryMap;
}
}
================================================
FILE: lib/Google/src/Utils/UriTemplate.php
================================================
"reserved",
"/" => "segments",
"." => "dotprefix",
"#" => "fragment",
";" => "semicolon",
"?" => "form",
"&" => "continuation"
];
/**
* @var array
* These are the characters which should not be URL encoded in reserved
* strings.
*/
private $reserved = [
"=", ",", "!", "@", "|", ":", "/", "?", "#",
"[", "]", '$', "&", "'", "(", ")", "*", "+", ";"
];
private $reservedEncoded = [
"%3D", "%2C", "%21", "%40", "%7C", "%3A", "%2F", "%3F",
"%23", "%5B", "%5D", "%24", "%26", "%27", "%28", "%29",
"%2A", "%2B", "%3B"
];
public function parse($string, array $parameters)
{
return $this->resolveNextSection($string, $parameters);
}
/**
* This function finds the first matching {...} block and
* executes the replacement. It then calls itself to find
* subsequent blocks, if any.
*/
private function resolveNextSection($string, $parameters)
{
$start = strpos($string, "{");
if ($start === false) {
return $string;
}
$end = strpos($string, "}");
if ($end === false) {
return $string;
}
$string = $this->replace($string, $start, $end, $parameters);
return $this->resolveNextSection($string, $parameters);
}
private function replace($string, $start, $end, $parameters)
{
// We know a data block will have {} round it, so we can strip that.
$data = substr($string, $start + 1, $end - $start - 1);
// If the first character is one of the reserved operators, it effects
// the processing of the stream.
if (isset($this->operators[$data[0]])) {
$op = $this->operators[$data[0]];
$data = substr($data, 1);
$prefix = "";
$prefix_on_missing = false;
switch ($op) {
case "reserved":
// Reserved means certain characters should not be URL encoded
$data = $this->replaceVars($data, $parameters, ",", null, true);
break;
case "fragment":
// Comma separated with fragment prefix. Bare values only.
$prefix = "#";
$prefix_on_missing = true;
$data = $this->replaceVars($data, $parameters, ",", null, true);
break;
case "segments":
// Slash separated data. Bare values only.
$prefix = "/";
$data =$this->replaceVars($data, $parameters, "/");
break;
case "dotprefix":
// Dot separated data. Bare values only.
$prefix = ".";
$prefix_on_missing = true;
$data = $this->replaceVars($data, $parameters, ".");
break;
case "semicolon":
// Semicolon prefixed and separated. Uses the key name
$prefix = ";";
$data = $this->replaceVars($data, $parameters, ";", "=", false, true, false);
break;
case "form":
// Standard URL format. Uses the key name
$prefix = "?";
$data = $this->replaceVars($data, $parameters, "&", "=");
break;
case "continuation":
// Standard URL, but with leading ampersand. Uses key name.
$prefix = "&";
$data = $this->replaceVars($data, $parameters, "&", "=");
break;
}
// Add the initial prefix character if data is valid.
if ($data || ($data !== false && $prefix_on_missing)) {
$data = $prefix . $data;
}
} else {
// If no operator we replace with the defaults.
$data = $this->replaceVars($data, $parameters);
}
// This is chops out the {...} and replaces with the new section.
return substr($string, 0, $start) . $data . substr($string, $end + 1);
}
private function replaceVars(
$section,
$parameters,
$sep = ",",
$combine = null,
$reserved = false,
$tag_empty = false,
$combine_on_empty = true
) {
if (strpos($section, ",") === false) {
// If we only have a single value, we can immediately process.
return $this->combine(
$section,
$parameters,
$sep,
$combine,
$reserved,
$tag_empty,
$combine_on_empty
);
} else {
// If we have multiple values, we need to split and loop over them.
// Each is treated individually, then glued together with the
// separator character.
$vars = explode(",", $section);
return $this->combineList(
$vars,
$sep,
$parameters,
$combine,
$reserved,
false, // Never emit empty strings in multi-param replacements
$combine_on_empty
);
}
}
public function combine(
$key,
$parameters,
$sep,
$combine,
$reserved,
$tag_empty,
$combine_on_empty
) {
$length = false;
$explode = false;
$skip_final_combine = false;
$value = false;
// Check for length restriction.
if (strpos($key, ":") !== false) {
list($key, $length) = explode(":", $key);
}
// Check for explode parameter.
if ($key[strlen($key) - 1] == "*") {
$explode = true;
$key = substr($key, 0, -1);
$skip_final_combine = true;
}
// Define the list separator.
$list_sep = $explode ? $sep : ",";
if (isset($parameters[$key])) {
$data_type = $this->getDataType($parameters[$key]);
switch ($data_type) {
case self::TYPE_SCALAR:
$value = $this->getValue($parameters[$key], $length);
break;
case self::TYPE_LIST:
$values = [];
foreach ($parameters[$key] as $pkey => $pvalue) {
$pvalue = $this->getValue($pvalue, $length);
if ($combine && $explode) {
$values[$pkey] = $key . $combine . $pvalue;
} else {
$values[$pkey] = $pvalue;
}
}
$value = implode($list_sep, $values);
if ($value == '') {
return '';
}
break;
case self::TYPE_MAP:
$values = [];
foreach ($parameters[$key] as $pkey => $pvalue) {
$pvalue = $this->getValue($pvalue, $length);
if ($explode) {
$pkey = $this->getValue($pkey, $length);
$values[] = $pkey . "=" . $pvalue; // Explode triggers = combine.
} else {
$values[] = $pkey;
$values[] = $pvalue;
}
}
$value = implode($list_sep, $values);
if ($value == '') {
return false;
}
break;
}
} elseif ($tag_empty) {
// If we are just indicating empty values with their key name, return that.
return $key;
} else {
// Otherwise we can skip this variable due to not being defined.
return false;
}
if ($reserved) {
$value = str_replace($this->reservedEncoded, $this->reserved, $value);
}
// If we do not need to include the key name, we just return the raw
// value.
if (!$combine || $skip_final_combine) {
return $value;
}
// Else we combine the key name: foo=bar, if value is not the empty string.
return $key . ($value != '' || $combine_on_empty ? $combine . $value : '');
}
/**
* Return the type of a passed in value
*/
private function getDataType($data)
{
if (is_array($data)) {
reset($data);
if (key($data) !== 0) {
return self::TYPE_MAP;
}
return self::TYPE_LIST;
}
return self::TYPE_SCALAR;
}
/**
* Utility function that merges multiple combine calls
* for multi-key templates.
*/
private function combineList(
$vars,
$sep,
$parameters,
$combine,
$reserved,
$tag_empty,
$combine_on_empty
) {
$ret = [];
foreach ($vars as $var) {
$response = $this->combine(
$var,
$parameters,
$sep,
$combine,
$reserved,
$tag_empty,
$combine_on_empty
);
if ($response === false) {
continue;
}
$ret[] = $response;
}
return implode($sep, $ret);
}
/**
* Utility function to encode and trim values
*/
private function getValue($value, $length)
{
if ($length) {
$value = substr($value, 0, $length);
}
$value = rawurlencode($value);
return $value;
}
}
================================================
FILE: lib/Google/src/aliases.php
================================================
'Google_Client',
'Google\\Service' => 'Google_Service',
'Google\\AccessToken\\Revoke' => 'Google_AccessToken_Revoke',
'Google\\AccessToken\\Verify' => 'Google_AccessToken_Verify',
'Google\\Model' => 'Google_Model',
'Google\\Utils\\UriTemplate' => 'Google_Utils_UriTemplate',
'Google\\AuthHandler\\Guzzle6AuthHandler' => 'Google_AuthHandler_Guzzle6AuthHandler',
'Google\\AuthHandler\\Guzzle7AuthHandler' => 'Google_AuthHandler_Guzzle7AuthHandler',
'Google\\AuthHandler\\AuthHandlerFactory' => 'Google_AuthHandler_AuthHandlerFactory',
'Google\\Http\\Batch' => 'Google_Http_Batch',
'Google\\Http\\MediaFileUpload' => 'Google_Http_MediaFileUpload',
'Google\\Http\\REST' => 'Google_Http_REST',
'Google\\Task\\Retryable' => 'Google_Task_Retryable',
'Google\\Task\\Exception' => 'Google_Task_Exception',
'Google\\Task\\Runner' => 'Google_Task_Runner',
'Google\\Collection' => 'Google_Collection',
'Google\\Service\\Exception' => 'Google_Service_Exception',
'Google\\Service\\Resource' => 'Google_Service_Resource',
'Google\\Exception' => 'Google_Exception',
];
foreach ($classMap as $class => $alias) {
class_alias($class, $alias);
}
/**
* This class needs to be defined explicitly as scripts must be recognized by
* the autoloader.
*/
class Google_Task_Composer extends \Google\Task\Composer
{
}
/** @phpstan-ignore-next-line */
if (\false) {
class Google_AccessToken_Revoke extends \Google\AccessToken\Revoke
{
}
class Google_AccessToken_Verify extends \Google\AccessToken\Verify
{
}
class Google_AuthHandler_AuthHandlerFactory extends \Google\AuthHandler\AuthHandlerFactory
{
}
class Google_AuthHandler_Guzzle6AuthHandler extends \Google\AuthHandler\Guzzle6AuthHandler
{
}
class Google_AuthHandler_Guzzle7AuthHandler extends \Google\AuthHandler\Guzzle7AuthHandler
{
}
class Google_Client extends \Google\Client
{
}
class Google_Collection extends \Google\Collection
{
}
class Google_Exception extends \Google\Exception
{
}
class Google_Http_Batch extends \Google\Http\Batch
{
}
class Google_Http_MediaFileUpload extends \Google\Http\MediaFileUpload
{
}
class Google_Http_REST extends \Google\Http\REST
{
}
class Google_Model extends \Google\Model
{
}
class Google_Service extends \Google\Service
{
}
class Google_Service_Exception extends \Google\Service\Exception
{
}
class Google_Service_Resource extends \Google\Service\Resource
{
}
class Google_Task_Exception extends \Google\Task\Exception
{
}
interface Google_Task_Retryable extends \Google\Task\Retryable
{
}
class Google_Task_Runner extends \Google\Task\Runner
{
}
class Google_Utils_UriTemplate extends \Google\Utils\UriTemplate
{
}
}
================================================
FILE: lib/Google/vendor/autoload.php
================================================
realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = fread($this->handle, $count);
if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}
$this->position += strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/google/cloud-core/bin/google-cloud-batch');
}
}
return include __DIR__ . '/..'.'/google/cloud-core/bin/google-cloud-batch';
================================================
FILE: lib/Google/vendor/brick/math/CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
## [0.13.1](https://github.com/brick/math/releases/tag/0.13.1) - 2025-03-29
✨ **Improvements**
- `__toString()` methods of `BigInteger` and `BigDecimal` are now type-hinted as returning `numeric-string` instead of `string` (#90 by @vudaltsov)
## [0.13.0](https://github.com/brick/math/releases/tag/0.13.0) - 2025-03-03
💥 **Breaking changes**
- `BigDecimal::ofUnscaledValue()` no longer throws an exception if the scale is negative
- `MathException` now extends `RuntimeException` instead of `Exception`; this reverts the change introduced in version `0.11.0` (#82)
✨ **New features**
- `BigDecimal::ofUnscaledValue()` allows a negative scale (and converts the values to create a zero scale number)
## [0.12.3](https://github.com/brick/math/releases/tag/0.12.3) - 2025-02-28
✨ **New features**
- `BigDecimal::getPrecision()` Returns the number of significant digits in a decimal number
## [0.12.2](https://github.com/brick/math/releases/tag/0.12.2) - 2025-02-26
⚡️ **Performance improvements**
- Division in `NativeCalculator` is now faster for small divisors, thanks to [@Izumi-kun](https://github.com/Izumi-kun) in [#87](https://github.com/brick/math/pull/87).
👌 **Improvements**
- Add missing `RoundingNecessaryException` to the `@throws` annotation of `BigNumber::of()`
## [0.12.1](https://github.com/brick/math/releases/tag/0.12.1) - 2023-11-29
⚡️ **Performance improvements**
- `BigNumber::of()` is now faster, thanks to [@SebastienDug](https://github.com/SebastienDug) in [#77](https://github.com/brick/math/pull/77).
## [0.12.0](https://github.com/brick/math/releases/tag/0.12.0) - 2023-11-26
💥 **Breaking changes**
- Minimum PHP version is now 8.1
- `RoundingMode` is now an `enum`; if you're type-hinting rounding modes, you need to type-hint against `RoundingMode` instead of `int` now
- `BigNumber` classes do not implement the `Serializable` interface anymore (they use the [new custom object serialization mechanism](https://wiki.php.net/rfc/custom_object_serialization))
- The following breaking changes only affect you if you're creating your own `BigNumber` subclasses:
- the return type of `BigNumber::of()` is now `static`
- `BigNumber` has a new abstract method `from()`
- all `public` and `protected` functions of `BigNumber` are now `final`
## [0.11.0](https://github.com/brick/math/releases/tag/0.11.0) - 2023-01-16
💥 **Breaking changes**
- Minimum PHP version is now 8.0
- Methods accepting a union of types are now strongly typed*
- `MathException` now extends `Exception` instead of `RuntimeException`
* You may now run into type errors if you were passing `Stringable` objects to `of()` or any of the methods
internally calling `of()`, with `strict_types` enabled. You can fix this by casting `Stringable` objects to `string`
first.
## [0.10.2](https://github.com/brick/math/releases/tag/0.10.2) - 2022-08-11
👌 **Improvements**
- `BigRational::toFloat()` now simplifies the fraction before performing division (#73) thanks to @olsavmic
## [0.10.1](https://github.com/brick/math/releases/tag/0.10.1) - 2022-08-02
✨ **New features**
- `BigInteger::gcdMultiple()` returns the GCD of multiple `BigInteger` numbers
## [0.10.0](https://github.com/brick/math/releases/tag/0.10.0) - 2022-06-18
💥 **Breaking changes**
- Minimum PHP version is now 7.4
## [0.9.3](https://github.com/brick/math/releases/tag/0.9.3) - 2021-08-15
🚀 **Compatibility with PHP 8.1**
- Support for custom object serialization; this removes a warning on PHP 8.1 due to the `Serializable` interface being deprecated (#60) thanks @TRowbotham
## [0.9.2](https://github.com/brick/math/releases/tag/0.9.2) - 2021-01-20
🐛 **Bug fix**
- Incorrect results could be returned when using the BCMath calculator, with a default scale set with `bcscale()`, on PHP >= 7.2 (#55).
## [0.9.1](https://github.com/brick/math/releases/tag/0.9.1) - 2020-08-19
✨ **New features**
- `BigInteger::not()` returns the bitwise `NOT` value
🐛 **Bug fixes**
- `BigInteger::toBytes()` could return an incorrect binary representation for some numbers
- The bitwise operations `and()`, `or()`, `xor()` on `BigInteger` could return an incorrect result when the GMP extension is not available
## [0.9.0](https://github.com/brick/math/releases/tag/0.9.0) - 2020-08-18
👌 **Improvements**
- `BigNumber::of()` now accepts `.123` and `123.` formats, both of which return a `BigDecimal`
💥 **Breaking changes**
- Deprecated method `BigInteger::powerMod()` has been removed - use `modPow()` instead
- Deprecated method `BigInteger::parse()` has been removed - use `fromBase()` instead
## [0.8.17](https://github.com/brick/math/releases/tag/0.8.17) - 2020-08-19
🐛 **Bug fix**
- `BigInteger::toBytes()` could return an incorrect binary representation for some numbers
- The bitwise operations `and()`, `or()`, `xor()` on `BigInteger` could return an incorrect result when the GMP extension is not available
## [0.8.16](https://github.com/brick/math/releases/tag/0.8.16) - 2020-08-18
🚑 **Critical fix**
- This version reintroduces the deprecated `BigInteger::parse()` method, that has been removed by mistake in version `0.8.9` and should have lasted for the whole `0.8` release cycle.
✨ **New features**
- `BigInteger::modInverse()` calculates a modular multiplicative inverse
- `BigInteger::fromBytes()` creates a `BigInteger` from a byte string
- `BigInteger::toBytes()` converts a `BigInteger` to a byte string
- `BigInteger::randomBits()` creates a pseudo-random `BigInteger` of a given bit length
- `BigInteger::randomRange()` creates a pseudo-random `BigInteger` between two bounds
💩 **Deprecations**
- `BigInteger::powerMod()` is now deprecated in favour of `modPow()`
## [0.8.15](https://github.com/brick/math/releases/tag/0.8.15) - 2020-04-15
🐛 **Fixes**
- added missing `ext-json` requirement, due to `BigNumber` implementing `JsonSerializable`
⚡️ **Optimizations**
- additional optimization in `BigInteger::remainder()`
## [0.8.14](https://github.com/brick/math/releases/tag/0.8.14) - 2020-02-18
✨ **New features**
- `BigInteger::getLowestSetBit()` returns the index of the rightmost one bit
## [0.8.13](https://github.com/brick/math/releases/tag/0.8.13) - 2020-02-16
✨ **New features**
- `BigInteger::isEven()` tests whether the number is even
- `BigInteger::isOdd()` tests whether the number is odd
- `BigInteger::testBit()` tests if a bit is set
- `BigInteger::getBitLength()` returns the number of bits in the minimal representation of the number
## [0.8.12](https://github.com/brick/math/releases/tag/0.8.12) - 2020-02-03
🛠️ **Maintenance release**
Classes are now annotated for better static analysis with [psalm](https://psalm.dev/).
This is a maintenance release: no bug fixes, no new features, no breaking changes.
## [0.8.11](https://github.com/brick/math/releases/tag/0.8.11) - 2020-01-23
✨ **New feature**
`BigInteger::powerMod()` performs a power-with-modulo operation. Useful for crypto.
## [0.8.10](https://github.com/brick/math/releases/tag/0.8.10) - 2020-01-21
✨ **New feature**
`BigInteger::mod()` returns the **modulo** of two numbers. The *modulo* differs from the *remainder* when the signs of the operands are different.
## [0.8.9](https://github.com/brick/math/releases/tag/0.8.9) - 2020-01-08
⚡️ **Performance improvements**
A few additional optimizations in `BigInteger` and `BigDecimal` when one of the operands can be returned as is. Thanks to @tomtomsen in #24.
## [0.8.8](https://github.com/brick/math/releases/tag/0.8.8) - 2019-04-25
🐛 **Bug fixes**
- `BigInteger::toBase()` could return an empty string for zero values (BCMath & Native calculators only, GMP calculator unaffected)
✨ **New features**
- `BigInteger::toArbitraryBase()` converts a number to an arbitrary base, using a custom alphabet
- `BigInteger::fromArbitraryBase()` converts a string in an arbitrary base, using a custom alphabet, back to a number
These methods can be used as the foundation to convert strings between different bases/alphabets, using BigInteger as an intermediate representation.
💩 **Deprecations**
- `BigInteger::parse()` is now deprecated in favour of `fromBase()`
`BigInteger::fromBase()` works the same way as `parse()`, with 2 minor differences:
- the `$base` parameter is required, it does not default to `10`
- it throws a `NumberFormatException` instead of an `InvalidArgumentException` when the number is malformed
## [0.8.7](https://github.com/brick/math/releases/tag/0.8.7) - 2019-04-20
**Improvements**
- Safer conversion from `float` when using custom locales
- **Much faster** `NativeCalculator` implementation 🚀
You can expect **at least a 3x performance improvement** for common arithmetic operations when using the library on systems without GMP or BCMath; it gets exponentially faster on multiplications with a high number of digits. This is due to calculations now being performed on whole blocks of digits (the block size depending on the platform, 32-bit or 64-bit) instead of digit-by-digit as before.
## [0.8.6](https://github.com/brick/math/releases/tag/0.8.6) - 2019-04-11
**New method**
`BigNumber::sum()` returns the sum of one or more numbers.
## [0.8.5](https://github.com/brick/math/releases/tag/0.8.5) - 2019-02-12
**Bug fix**: `of()` factory methods could fail when passing a `float` in environments using a `LC_NUMERIC` locale with a decimal separator other than `'.'` (#20).
Thanks @manowark 👍
## [0.8.4](https://github.com/brick/math/releases/tag/0.8.4) - 2018-12-07
**New method**
`BigDecimal::sqrt()` calculates the square root of a decimal number, to a given scale.
## [0.8.3](https://github.com/brick/math/releases/tag/0.8.3) - 2018-12-06
**New method**
`BigInteger::sqrt()` calculates the square root of a number (thanks @peter279k).
**New exception**
`NegativeNumberException` is thrown when calling `sqrt()` on a negative number.
## [0.8.2](https://github.com/brick/math/releases/tag/0.8.2) - 2018-11-08
**Performance update**
- Further improvement of `toInt()` performance
- `NativeCalculator` can now perform some multiplications more efficiently
## [0.8.1](https://github.com/brick/math/releases/tag/0.8.1) - 2018-11-07
Performance optimization of `toInt()` methods.
## [0.8.0](https://github.com/brick/math/releases/tag/0.8.0) - 2018-10-13
**Breaking changes**
The following deprecated methods have been removed. Use the new method name instead:
| Method removed | Replacement method |
| --- | --- |
| `BigDecimal::getIntegral()` | `BigDecimal::getIntegralPart()` |
| `BigDecimal::getFraction()` | `BigDecimal::getFractionalPart()` |
---
**New features**
`BigInteger` has been augmented with 5 new methods for bitwise operations:
| New method | Description |
| --- | --- |
| `and()` | performs a bitwise `AND` operation on two numbers |
| `or()` | performs a bitwise `OR` operation on two numbers |
| `xor()` | performs a bitwise `XOR` operation on two numbers |
| `shiftedLeft()` | returns the number shifted left by a number of bits |
| `shiftedRight()` | returns the number shifted right by a number of bits |
Thanks to @DASPRiD 👍
## [0.7.3](https://github.com/brick/math/releases/tag/0.7.3) - 2018-08-20
**New method:** `BigDecimal::hasNonZeroFractionalPart()`
**Renamed/deprecated methods:**
- `BigDecimal::getIntegral()` has been renamed to `getIntegralPart()` and is now deprecated
- `BigDecimal::getFraction()` has been renamed to `getFractionalPart()` and is now deprecated
## [0.7.2](https://github.com/brick/math/releases/tag/0.7.2) - 2018-07-21
**Performance update**
`BigInteger::parse()` and `toBase()` now use GMP's built-in base conversion features when available.
## [0.7.1](https://github.com/brick/math/releases/tag/0.7.1) - 2018-03-01
This is a maintenance release, no code has been changed.
- When installed with `--no-dev`, the autoloader does not autoload tests anymore
- Tests and other files unnecessary for production are excluded from the dist package
This will help make installations more compact.
## [0.7.0](https://github.com/brick/math/releases/tag/0.7.0) - 2017-10-02
Methods renamed:
- `BigNumber:sign()` has been renamed to `getSign()`
- `BigDecimal::unscaledValue()` has been renamed to `getUnscaledValue()`
- `BigDecimal::scale()` has been renamed to `getScale()`
- `BigDecimal::integral()` has been renamed to `getIntegral()`
- `BigDecimal::fraction()` has been renamed to `getFraction()`
- `BigRational::numerator()` has been renamed to `getNumerator()`
- `BigRational::denominator()` has been renamed to `getDenominator()`
Classes renamed:
- `ArithmeticException` has been renamed to `MathException`
## [0.6.2](https://github.com/brick/math/releases/tag/0.6.2) - 2017-10-02
The base class for all exceptions is now `MathException`.
`ArithmeticException` has been deprecated, and will be removed in 0.7.0.
## [0.6.1](https://github.com/brick/math/releases/tag/0.6.1) - 2017-10-02
A number of methods have been renamed:
- `BigNumber:sign()` is deprecated; use `getSign()` instead
- `BigDecimal::unscaledValue()` is deprecated; use `getUnscaledValue()` instead
- `BigDecimal::scale()` is deprecated; use `getScale()` instead
- `BigDecimal::integral()` is deprecated; use `getIntegral()` instead
- `BigDecimal::fraction()` is deprecated; use `getFraction()` instead
- `BigRational::numerator()` is deprecated; use `getNumerator()` instead
- `BigRational::denominator()` is deprecated; use `getDenominator()` instead
The old methods will be removed in version 0.7.0.
## [0.6.0](https://github.com/brick/math/releases/tag/0.6.0) - 2017-08-25
- Minimum PHP version is now [7.1](https://gophp71.org/); for PHP 5.6 and PHP 7.0 support, use version `0.5`
- Deprecated method `BigDecimal::withScale()` has been removed; use `toScale()` instead
- Method `BigNumber::toInteger()` has been renamed to `toInt()`
## [0.5.4](https://github.com/brick/math/releases/tag/0.5.4) - 2016-10-17
`BigNumber` classes now implement [JsonSerializable](http://php.net/manual/en/class.jsonserializable.php).
The JSON output is always a string.
## [0.5.3](https://github.com/brick/math/releases/tag/0.5.3) - 2016-03-31
This is a bugfix release. Dividing by a negative power of 1 with the same scale as the dividend could trigger an incorrect optimization which resulted in a wrong result. See #6.
## [0.5.2](https://github.com/brick/math/releases/tag/0.5.2) - 2015-08-06
The `$scale` parameter of `BigDecimal::dividedBy()` is now optional again.
## [0.5.1](https://github.com/brick/math/releases/tag/0.5.1) - 2015-07-05
**New method: `BigNumber::toScale()`**
This allows to convert any `BigNumber` to a `BigDecimal` with a given scale, using rounding if necessary.
## [0.5.0](https://github.com/brick/math/releases/tag/0.5.0) - 2015-07-04
**New features**
- Common `BigNumber` interface for all classes, with the following methods:
- `sign()` and derived methods (`isZero()`, `isPositive()`, ...)
- `compareTo()` and derived methods (`isEqualTo()`, `isGreaterThan()`, ...) that work across different `BigNumber` types
- `toBigInteger()`, `toBigDecimal()`, `toBigRational`() conversion methods
- `toInteger()` and `toFloat()` conversion methods to native types
- Unified `of()` behaviour: every class now accepts any type of number, provided that it can be safely converted to the current type
- New method: `BigDecimal::exactlyDividedBy()`; this method automatically computes the scale of the result, provided that the division yields a finite number of digits
- New methods: `BigRational::quotient()` and `remainder()`
- Fine-grained exceptions: `DivisionByZeroException`, `RoundingNecessaryException`, `NumberFormatException`
- Factory methods `zero()`, `one()` and `ten()` available in all classes
- Rounding mode reintroduced in `BigInteger::dividedBy()`
This release also comes with many performance improvements.
---
**Breaking changes**
- `BigInteger`:
- `getSign()` is renamed to `sign()`
- `toString()` is renamed to `toBase()`
- `BigInteger::dividedBy()` now throws an exception by default if the remainder is not zero; use `quotient()` to get the previous behaviour
- `BigDecimal`:
- `getSign()` is renamed to `sign()`
- `getUnscaledValue()` is renamed to `unscaledValue()`
- `getScale()` is renamed to `scale()`
- `getIntegral()` is renamed to `integral()`
- `getFraction()` is renamed to `fraction()`
- `divideAndRemainder()` is renamed to `quotientAndRemainder()`
- `dividedBy()` now takes a **mandatory** `$scale` parameter **before** the rounding mode
- `toBigInteger()` does not accept a `$roundingMode` parameter anymore
- `toBigRational()` does not simplify the fraction anymore; explicitly add `->simplified()` to get the previous behaviour
- `BigRational`:
- `getSign()` is renamed to `sign()`
- `getNumerator()` is renamed to `numerator()`
- `getDenominator()` is renamed to `denominator()`
- `of()` is renamed to `nd()`, while `parse()` is renamed to `of()`
- Miscellaneous:
- `ArithmeticException` is moved to an `Exception\` sub-namespace
- `of()` factory methods now throw `NumberFormatException` instead of `InvalidArgumentException`
## [0.4.3](https://github.com/brick/math/releases/tag/0.4.3) - 2016-03-31
Backport of two bug fixes from the 0.5 branch:
- `BigInteger::parse()` did not always throw `InvalidArgumentException` as expected
- Dividing by a negative power of 1 with the same scale as the dividend could trigger an incorrect optimization which resulted in a wrong result. See #6.
## [0.4.2](https://github.com/brick/math/releases/tag/0.4.2) - 2015-06-16
New method: `BigDecimal::stripTrailingZeros()`
## [0.4.1](https://github.com/brick/math/releases/tag/0.4.1) - 2015-06-12
Introducing a `BigRational` class, to perform calculations on fractions of any size.
## [0.4.0](https://github.com/brick/math/releases/tag/0.4.0) - 2015-06-12
Rounding modes have been removed from `BigInteger`, and are now a concept specific to `BigDecimal`.
`BigInteger::dividedBy()` now always returns the quotient of the division.
## [0.3.5](https://github.com/brick/math/releases/tag/0.3.5) - 2016-03-31
Backport of two bug fixes from the 0.5 branch:
- `BigInteger::parse()` did not always throw `InvalidArgumentException` as expected
- Dividing by a negative power of 1 with the same scale as the dividend could trigger an incorrect optimization which resulted in a wrong result. See #6.
## [0.3.4](https://github.com/brick/math/releases/tag/0.3.4) - 2015-06-11
New methods:
- `BigInteger::remainder()` returns the remainder of a division only
- `BigInteger::gcd()` returns the greatest common divisor of two numbers
## [0.3.3](https://github.com/brick/math/releases/tag/0.3.3) - 2015-06-07
Fix `toString()` not handling negative numbers.
## [0.3.2](https://github.com/brick/math/releases/tag/0.3.2) - 2015-06-07
`BigInteger` and `BigDecimal` now have a `getSign()` method that returns:
- `-1` if the number is negative
- `0` if the number is zero
- `1` if the number is positive
## [0.3.1](https://github.com/brick/math/releases/tag/0.3.1) - 2015-06-05
Minor performance improvements
## [0.3.0](https://github.com/brick/math/releases/tag/0.3.0) - 2015-06-04
The `$roundingMode` and `$scale` parameters have been swapped in `BigDecimal::dividedBy()`.
## [0.2.2](https://github.com/brick/math/releases/tag/0.2.2) - 2015-06-04
Stronger immutability guarantee for `BigInteger` and `BigDecimal`.
So far, it would have been possible to break immutability of these classes by calling the `unserialize()` internal function. This release fixes that.
## [0.2.1](https://github.com/brick/math/releases/tag/0.2.1) - 2015-06-02
Added `BigDecimal::divideAndRemainder()`
## [0.2.0](https://github.com/brick/math/releases/tag/0.2.0) - 2015-05-22
- `min()` and `max()` do not accept an `array` anymore, but a variable number of parameters
- **minimum PHP version is now 5.6**
- continuous integration with PHP 7
## [0.1.1](https://github.com/brick/math/releases/tag/0.1.1) - 2014-09-01
- Added `BigInteger::power()`
- Added HHVM support
## [0.1.0](https://github.com/brick/math/releases/tag/0.1.0) - 2014-08-31
First beta release.
================================================
FILE: lib/Google/vendor/brick/math/LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2013-present Benjamin Morel
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: lib/Google/vendor/brick/math/composer.json
================================================
{
"name": "brick/math",
"description": "Arbitrary-precision arithmetic library",
"type": "library",
"keywords": [
"Brick",
"Math",
"Mathematics",
"Arbitrary-precision",
"Arithmetic",
"BigInteger",
"BigDecimal",
"BigRational",
"BigNumber",
"Bignum",
"Decimal",
"Rational",
"Integer"
],
"license": "MIT",
"require": {
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^10.1",
"php-coveralls/php-coveralls": "^2.2",
"vimeo/psalm": "6.8.8"
},
"autoload": {
"psr-4": {
"Brick\\Math\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Brick\\Math\\Tests\\": "tests/"
}
}
}
================================================
FILE: lib/Google/vendor/brick/math/psalm-baseline.xml
================================================
================================================
FILE: lib/Google/vendor/brick/math/src/BigDecimal.php
================================================
value = $value;
$this->scale = $scale;
}
/**
* @psalm-pure
*/
#[Override]
protected static function from(BigNumber $number): static
{
return $number->toBigDecimal();
}
/**
* Creates a BigDecimal from an unscaled value and a scale.
*
* Example: `(12345, 3)` will result in the BigDecimal `12.345`.
*
* @param BigNumber|int|float|string $value The unscaled value. Must be convertible to a BigInteger.
* @param int $scale The scale of the number. If negative, the scale will be set to zero
* and the unscaled value will be adjusted accordingly.
*
* @psalm-pure
*/
public static function ofUnscaledValue(BigNumber|int|float|string $value, int $scale = 0) : BigDecimal
{
$value = (string) BigInteger::of($value);
if ($scale < 0) {
if ($value !== '0') {
$value .= \str_repeat('0', -$scale);
}
$scale = 0;
}
return new BigDecimal($value, $scale);
}
/**
* Returns a BigDecimal representing zero, with a scale of zero.
*
* @psalm-pure
*/
public static function zero() : BigDecimal
{
/**
* @psalm-suppress ImpureStaticVariable
* @var BigDecimal|null $zero
*/
static $zero;
if ($zero === null) {
$zero = new BigDecimal('0');
}
return $zero;
}
/**
* Returns a BigDecimal representing one, with a scale of zero.
*
* @psalm-pure
*/
public static function one() : BigDecimal
{
/**
* @psalm-suppress ImpureStaticVariable
* @var BigDecimal|null $one
*/
static $one;
if ($one === null) {
$one = new BigDecimal('1');
}
return $one;
}
/**
* Returns a BigDecimal representing ten, with a scale of zero.
*
* @psalm-pure
*/
public static function ten() : BigDecimal
{
/**
* @psalm-suppress ImpureStaticVariable
* @var BigDecimal|null $ten
*/
static $ten;
if ($ten === null) {
$ten = new BigDecimal('10');
}
return $ten;
}
/**
* Returns the sum of this number and the given one.
*
* The result has a scale of `max($this->scale, $that->scale)`.
*
* @param BigNumber|int|float|string $that The number to add. Must be convertible to a BigDecimal.
*
* @throws MathException If the number is not valid, or is not convertible to a BigDecimal.
*/
public function plus(BigNumber|int|float|string $that) : BigDecimal
{
$that = BigDecimal::of($that);
if ($that->value === '0' && $that->scale <= $this->scale) {
return $this;
}
if ($this->value === '0' && $this->scale <= $that->scale) {
return $that;
}
[$a, $b] = $this->scaleValues($this, $that);
$value = Calculator::get()->add($a, $b);
$scale = $this->scale > $that->scale ? $this->scale : $that->scale;
return new BigDecimal($value, $scale);
}
/**
* Returns the difference of this number and the given one.
*
* The result has a scale of `max($this->scale, $that->scale)`.
*
* @param BigNumber|int|float|string $that The number to subtract. Must be convertible to a BigDecimal.
*
* @throws MathException If the number is not valid, or is not convertible to a BigDecimal.
*/
public function minus(BigNumber|int|float|string $that) : BigDecimal
{
$that = BigDecimal::of($that);
if ($that->value === '0' && $that->scale <= $this->scale) {
return $this;
}
[$a, $b] = $this->scaleValues($this, $that);
$value = Calculator::get()->sub($a, $b);
$scale = $this->scale > $that->scale ? $this->scale : $that->scale;
return new BigDecimal($value, $scale);
}
/**
* Returns the product of this number and the given one.
*
* The result has a scale of `$this->scale + $that->scale`.
*
* @param BigNumber|int|float|string $that The multiplier. Must be convertible to a BigDecimal.
*
* @throws MathException If the multiplier is not a valid number, or is not convertible to a BigDecimal.
*/
public function multipliedBy(BigNumber|int|float|string $that) : BigDecimal
{
$that = BigDecimal::of($that);
if ($that->value === '1' && $that->scale === 0) {
return $this;
}
if ($this->value === '1' && $this->scale === 0) {
return $that;
}
$value = Calculator::get()->mul($this->value, $that->value);
$scale = $this->scale + $that->scale;
return new BigDecimal($value, $scale);
}
/**
* Returns the result of the division of this number by the given one, at the given scale.
*
* @param BigNumber|int|float|string $that The divisor.
* @param int|null $scale The desired scale, or null to use the scale of this number.
* @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY.
*
* @throws \InvalidArgumentException If the scale or rounding mode is invalid.
* @throws MathException If the number is invalid, is zero, or rounding was necessary.
*/
public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
{
$that = BigDecimal::of($that);
if ($that->isZero()) {
throw DivisionByZeroException::divisionByZero();
}
if ($scale === null) {
$scale = $this->scale;
} elseif ($scale < 0) {
throw new \InvalidArgumentException('Scale cannot be negative.');
}
if ($that->value === '1' && $that->scale === 0 && $scale === $this->scale) {
return $this;
}
$p = $this->valueWithMinScale($that->scale + $scale);
$q = $that->valueWithMinScale($this->scale - $scale);
$result = Calculator::get()->divRound($p, $q, $roundingMode);
return new BigDecimal($result, $scale);
}
/**
* Returns the exact result of the division of this number by the given one.
*
* The scale of the result is automatically calculated to fit all the fraction digits.
*
* @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal.
*
* @throws MathException If the divisor is not a valid number, is not convertible to a BigDecimal, is zero,
* or the result yields an infinite number of digits.
*/
public function exactlyDividedBy(BigNumber|int|float|string $that) : BigDecimal
{
$that = BigDecimal::of($that);
if ($that->value === '0') {
throw DivisionByZeroException::divisionByZero();
}
[, $b] = $this->scaleValues($this, $that);
$d = \rtrim($b, '0');
$scale = \strlen($b) - \strlen($d);
$calculator = Calculator::get();
foreach ([5, 2] as $prime) {
for (;;) {
$lastDigit = (int) $d[-1];
if ($lastDigit % $prime !== 0) {
break;
}
$d = $calculator->divQ($d, (string) $prime);
$scale++;
}
}
return $this->dividedBy($that, $scale)->stripTrailingZeros();
}
/**
* Returns this number exponentiated to the given value.
*
* The result has a scale of `$this->scale * $exponent`.
*
* @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000.
*/
public function power(int $exponent) : BigDecimal
{
if ($exponent === 0) {
return BigDecimal::one();
}
if ($exponent === 1) {
return $this;
}
if ($exponent < 0 || $exponent > Calculator::MAX_POWER) {
throw new \InvalidArgumentException(\sprintf(
'The exponent %d is not in the range 0 to %d.',
$exponent,
Calculator::MAX_POWER
));
}
return new BigDecimal(Calculator::get()->pow($this->value, $exponent), $this->scale * $exponent);
}
/**
* Returns the quotient of the division of this number by the given one.
*
* The quotient has a scale of `0`.
*
* @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal.
*
* @throws MathException If the divisor is not a valid decimal number, or is zero.
*/
public function quotient(BigNumber|int|float|string $that) : BigDecimal
{
$that = BigDecimal::of($that);
if ($that->isZero()) {
throw DivisionByZeroException::divisionByZero();
}
$p = $this->valueWithMinScale($that->scale);
$q = $that->valueWithMinScale($this->scale);
$quotient = Calculator::get()->divQ($p, $q);
return new BigDecimal($quotient, 0);
}
/**
* Returns the remainder of the division of this number by the given one.
*
* The remainder has a scale of `max($this->scale, $that->scale)`.
*
* @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal.
*
* @throws MathException If the divisor is not a valid decimal number, or is zero.
*/
public function remainder(BigNumber|int|float|string $that) : BigDecimal
{
$that = BigDecimal::of($that);
if ($that->isZero()) {
throw DivisionByZeroException::divisionByZero();
}
$p = $this->valueWithMinScale($that->scale);
$q = $that->valueWithMinScale($this->scale);
$remainder = Calculator::get()->divR($p, $q);
$scale = $this->scale > $that->scale ? $this->scale : $that->scale;
return new BigDecimal($remainder, $scale);
}
/**
* Returns the quotient and remainder of the division of this number by the given one.
*
* The quotient has a scale of `0`, and the remainder has a scale of `max($this->scale, $that->scale)`.
*
* @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal.
*
* @return BigDecimal[] An array containing the quotient and the remainder.
*
* @psalm-return array{BigDecimal, BigDecimal}
*
* @throws MathException If the divisor is not a valid decimal number, or is zero.
*/
public function quotientAndRemainder(BigNumber|int|float|string $that) : array
{
$that = BigDecimal::of($that);
if ($that->isZero()) {
throw DivisionByZeroException::divisionByZero();
}
$p = $this->valueWithMinScale($that->scale);
$q = $that->valueWithMinScale($this->scale);
[$quotient, $remainder] = Calculator::get()->divQR($p, $q);
$scale = $this->scale > $that->scale ? $this->scale : $that->scale;
$quotient = new BigDecimal($quotient, 0);
$remainder = new BigDecimal($remainder, $scale);
return [$quotient, $remainder];
}
/**
* Returns the square root of this number, rounded down to the given number of decimals.
*
* @throws \InvalidArgumentException If the scale is negative.
* @throws NegativeNumberException If this number is negative.
*/
public function sqrt(int $scale) : BigDecimal
{
if ($scale < 0) {
throw new \InvalidArgumentException('Scale cannot be negative.');
}
if ($this->value === '0') {
return new BigDecimal('0', $scale);
}
if ($this->value[0] === '-') {
throw new NegativeNumberException('Cannot calculate the square root of a negative number.');
}
$value = $this->value;
$addDigits = 2 * $scale - $this->scale;
if ($addDigits > 0) {
// add zeros
$value .= \str_repeat('0', $addDigits);
} elseif ($addDigits < 0) {
// trim digits
if (-$addDigits >= \strlen($this->value)) {
// requesting a scale too low, will always yield a zero result
return new BigDecimal('0', $scale);
}
$value = \substr($value, 0, $addDigits);
}
$value = Calculator::get()->sqrt($value);
return new BigDecimal($value, $scale);
}
/**
* Returns a copy of this BigDecimal with the decimal point moved $n places to the left.
*/
public function withPointMovedLeft(int $n) : BigDecimal
{
if ($n === 0) {
return $this;
}
if ($n < 0) {
return $this->withPointMovedRight(-$n);
}
return new BigDecimal($this->value, $this->scale + $n);
}
/**
* Returns a copy of this BigDecimal with the decimal point moved $n places to the right.
*/
public function withPointMovedRight(int $n) : BigDecimal
{
if ($n === 0) {
return $this;
}
if ($n < 0) {
return $this->withPointMovedLeft(-$n);
}
$value = $this->value;
$scale = $this->scale - $n;
if ($scale < 0) {
if ($value !== '0') {
$value .= \str_repeat('0', -$scale);
}
$scale = 0;
}
return new BigDecimal($value, $scale);
}
/**
* Returns a copy of this BigDecimal with any trailing zeros removed from the fractional part.
*/
public function stripTrailingZeros() : BigDecimal
{
if ($this->scale === 0) {
return $this;
}
$trimmedValue = \rtrim($this->value, '0');
if ($trimmedValue === '') {
return BigDecimal::zero();
}
$trimmableZeros = \strlen($this->value) - \strlen($trimmedValue);
if ($trimmableZeros === 0) {
return $this;
}
if ($trimmableZeros > $this->scale) {
$trimmableZeros = $this->scale;
}
$value = \substr($this->value, 0, -$trimmableZeros);
$scale = $this->scale - $trimmableZeros;
return new BigDecimal($value, $scale);
}
/**
* Returns the absolute value of this number.
*/
public function abs() : BigDecimal
{
return $this->isNegative() ? $this->negated() : $this;
}
/**
* Returns the negated value of this number.
*/
public function negated() : BigDecimal
{
return new BigDecimal(Calculator::get()->neg($this->value), $this->scale);
}
#[Override]
public function compareTo(BigNumber|int|float|string $that) : int
{
$that = BigNumber::of($that);
if ($that instanceof BigInteger) {
$that = $that->toBigDecimal();
}
if ($that instanceof BigDecimal) {
[$a, $b] = $this->scaleValues($this, $that);
return Calculator::get()->cmp($a, $b);
}
return - $that->compareTo($this);
}
#[Override]
public function getSign() : int
{
return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1);
}
public function getUnscaledValue() : BigInteger
{
return self::newBigInteger($this->value);
}
public function getScale() : int
{
return $this->scale;
}
/**
* Returns the number of significant digits in the number.
*
* This is the number of digits to both sides of the decimal point, stripped of leading zeros.
* The sign has no impact on the result.
*
* Examples:
* 0 => 0
* 0.0 => 0
* 123 => 3
* 123.456 => 6
* 0.00123 => 3
* 0.0012300 => 5
*/
public function getPrecision(): int
{
$value = $this->value;
if ($value === '0') {
return 0;
}
$length = \strlen($value);
return ($value[0] === '-') ? $length - 1 : $length;
}
/**
* Returns a string representing the integral part of this decimal number.
*
* Example: `-123.456` => `-123`.
*/
public function getIntegralPart() : string
{
if ($this->scale === 0) {
return $this->value;
}
$value = $this->getUnscaledValueWithLeadingZeros();
return \substr($value, 0, -$this->scale);
}
/**
* Returns a string representing the fractional part of this decimal number.
*
* If the scale is zero, an empty string is returned.
*
* Examples: `-123.456` => '456', `123` => ''.
*/
public function getFractionalPart() : string
{
if ($this->scale === 0) {
return '';
}
$value = $this->getUnscaledValueWithLeadingZeros();
return \substr($value, -$this->scale);
}
/**
* Returns whether this decimal number has a non-zero fractional part.
*/
public function hasNonZeroFractionalPart() : bool
{
return $this->getFractionalPart() !== \str_repeat('0', $this->scale);
}
#[Override]
public function toBigInteger() : BigInteger
{
$zeroScaleDecimal = $this->scale === 0 ? $this : $this->dividedBy(1, 0);
return self::newBigInteger($zeroScaleDecimal->value);
}
#[Override]
public function toBigDecimal() : BigDecimal
{
return $this;
}
#[Override]
public function toBigRational() : BigRational
{
$numerator = self::newBigInteger($this->value);
$denominator = self::newBigInteger('1' . \str_repeat('0', $this->scale));
return self::newBigRational($numerator, $denominator, false);
}
#[Override]
public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
{
if ($scale === $this->scale) {
return $this;
}
return $this->dividedBy(BigDecimal::one(), $scale, $roundingMode);
}
#[Override]
public function toInt() : int
{
return $this->toBigInteger()->toInt();
}
#[Override]
public function toFloat() : float
{
return (float) (string) $this;
}
/**
* @return numeric-string
*/
#[Override]
public function __toString() : string
{
if ($this->scale === 0) {
/** @var numeric-string */
return $this->value;
}
$value = $this->getUnscaledValueWithLeadingZeros();
/** @var numeric-string */
return \substr($value, 0, -$this->scale) . '.' . \substr($value, -$this->scale);
}
/**
* This method is required for serializing the object and SHOULD NOT be accessed directly.
*
* @internal
*
* @return array{value: string, scale: int}
*/
public function __serialize(): array
{
return ['value' => $this->value, 'scale' => $this->scale];
}
/**
* This method is only here to allow unserializing the object and cannot be accessed directly.
*
* @internal
* @psalm-suppress RedundantPropertyInitializationCheck
*
* @param array{value: string, scale: int} $data
*
* @throws \LogicException
*/
public function __unserialize(array $data): void
{
if (isset($this->value)) {
throw new \LogicException('__unserialize() is an internal function, it must not be called directly.');
}
$this->value = $data['value'];
$this->scale = $data['scale'];
}
/**
* Puts the internal values of the given decimal numbers on the same scale.
*
* @return array{string, string} The scaled integer values of $x and $y.
*/
private function scaleValues(BigDecimal $x, BigDecimal $y) : array
{
$a = $x->value;
$b = $y->value;
if ($b !== '0' && $x->scale > $y->scale) {
$b .= \str_repeat('0', $x->scale - $y->scale);
} elseif ($a !== '0' && $x->scale < $y->scale) {
$a .= \str_repeat('0', $y->scale - $x->scale);
}
return [$a, $b];
}
private function valueWithMinScale(int $scale) : string
{
$value = $this->value;
if ($this->value !== '0' && $scale > $this->scale) {
$value .= \str_repeat('0', $scale - $this->scale);
}
return $value;
}
/**
* Adds leading zeros if necessary to the unscaled value to represent the full decimal number.
*/
private function getUnscaledValueWithLeadingZeros() : string
{
$value = $this->value;
$targetLength = $this->scale + 1;
$negative = ($value[0] === '-');
$length = \strlen($value);
if ($negative) {
$length--;
}
if ($length >= $targetLength) {
return $this->value;
}
if ($negative) {
$value = \substr($value, 1);
}
$value = \str_pad($value, $targetLength, '0', STR_PAD_LEFT);
if ($negative) {
$value = '-' . $value;
}
return $value;
}
}
================================================
FILE: lib/Google/vendor/brick/math/src/BigInteger.php
================================================
value = $value;
}
/**
* @psalm-pure
*/
#[Override]
protected static function from(BigNumber $number): static
{
return $number->toBigInteger();
}
/**
* Creates a number from a string in a given base.
*
* The string can optionally be prefixed with the `+` or `-` sign.
*
* Bases greater than 36 are not supported by this method, as there is no clear consensus on which of the lowercase
* or uppercase characters should come first. Instead, this method accepts any base up to 36, and does not
* differentiate lowercase and uppercase characters, which are considered equal.
*
* For bases greater than 36, and/or custom alphabets, use the fromArbitraryBase() method.
*
* @param string $number The number to convert, in the given base.
* @param int $base The base of the number, between 2 and 36.
*
* @throws NumberFormatException If the number is empty, or contains invalid chars for the given base.
* @throws \InvalidArgumentException If the base is out of range.
*
* @psalm-pure
*/
public static function fromBase(string $number, int $base) : BigInteger
{
if ($number === '') {
throw new NumberFormatException('The number cannot be empty.');
}
if ($base < 2 || $base > 36) {
throw new \InvalidArgumentException(\sprintf('Base %d is not in range 2 to 36.', $base));
}
if ($number[0] === '-') {
$sign = '-';
$number = \substr($number, 1);
} elseif ($number[0] === '+') {
$sign = '';
$number = \substr($number, 1);
} else {
$sign = '';
}
if ($number === '') {
throw new NumberFormatException('The number cannot be empty.');
}
$number = \ltrim($number, '0');
if ($number === '') {
// The result will be the same in any base, avoid further calculation.
return BigInteger::zero();
}
if ($number === '1') {
// The result will be the same in any base, avoid further calculation.
return new BigInteger($sign . '1');
}
$pattern = '/[^' . \substr(Calculator::ALPHABET, 0, $base) . ']/';
if (\preg_match($pattern, \strtolower($number), $matches) === 1) {
throw new NumberFormatException(\sprintf('"%s" is not a valid character in base %d.', $matches[0], $base));
}
if ($base === 10) {
// The number is usable as is, avoid further calculation.
return new BigInteger($sign . $number);
}
$result = Calculator::get()->fromBase($number, $base);
return new BigInteger($sign . $result);
}
/**
* Parses a string containing an integer in an arbitrary base, using a custom alphabet.
*
* Because this method accepts an alphabet with any character, including dash, it does not handle negative numbers.
*
* @param string $number The number to parse.
* @param string $alphabet The alphabet, for example '01' for base 2, or '01234567' for base 8.
*
* @throws NumberFormatException If the given number is empty or contains invalid chars for the given alphabet.
* @throws \InvalidArgumentException If the alphabet does not contain at least 2 chars.
*
* @psalm-pure
*/
public static function fromArbitraryBase(string $number, string $alphabet) : BigInteger
{
if ($number === '') {
throw new NumberFormatException('The number cannot be empty.');
}
$base = \strlen($alphabet);
if ($base < 2) {
throw new \InvalidArgumentException('The alphabet must contain at least 2 chars.');
}
$pattern = '/[^' . \preg_quote($alphabet, '/') . ']/';
if (\preg_match($pattern, $number, $matches) === 1) {
throw NumberFormatException::charNotInAlphabet($matches[0]);
}
$number = Calculator::get()->fromArbitraryBase($number, $alphabet, $base);
return new BigInteger($number);
}
/**
* Translates a string of bytes containing the binary representation of a BigInteger into a BigInteger.
*
* The input string is assumed to be in big-endian byte-order: the most significant byte is in the zeroth element.
*
* If `$signed` is true, the input is assumed to be in two's-complement representation, and the leading bit is
* interpreted as a sign bit. If `$signed` is false, the input is interpreted as an unsigned number, and the
* resulting BigInteger will always be positive or zero.
*
* This method can be used to retrieve a number exported by `toBytes()`, as long as the `$signed` flags match.
*
* @param string $value The byte string.
* @param bool $signed Whether to interpret as a signed number in two's-complement representation with a leading
* sign bit.
*
* @throws NumberFormatException If the string is empty.
*/
public static function fromBytes(string $value, bool $signed = true) : BigInteger
{
if ($value === '') {
throw new NumberFormatException('The byte string must not be empty.');
}
$twosComplement = false;
if ($signed) {
$x = \ord($value[0]);
if (($twosComplement = ($x >= 0x80))) {
$value = ~$value;
}
}
$number = self::fromBase(\bin2hex($value), 16);
if ($twosComplement) {
return $number->plus(1)->negated();
}
return $number;
}
/**
* Generates a pseudo-random number in the range 0 to 2^numBits - 1.
*
* Using the default random bytes generator, this method is suitable for cryptographic use.
*
* @psalm-param (callable(int): string)|null $randomBytesGenerator
*
* @param int $numBits The number of bits.
* @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, and returns a
* string of random bytes of the given length. Defaults to the
* `random_bytes()` function.
*
* @throws \InvalidArgumentException If $numBits is negative.
*/
public static function randomBits(int $numBits, ?callable $randomBytesGenerator = null) : BigInteger
{
if ($numBits < 0) {
throw new \InvalidArgumentException('The number of bits cannot be negative.');
}
if ($numBits === 0) {
return BigInteger::zero();
}
if ($randomBytesGenerator === null) {
$randomBytesGenerator = random_bytes(...);
}
/** @var int<1, max> $byteLength */
$byteLength = \intdiv($numBits - 1, 8) + 1;
$extraBits = ($byteLength * 8 - $numBits);
$bitmask = \chr(0xFF >> $extraBits);
$randomBytes = $randomBytesGenerator($byteLength);
$randomBytes[0] = $randomBytes[0] & $bitmask;
return self::fromBytes($randomBytes, false);
}
/**
* Generates a pseudo-random number between `$min` and `$max`.
*
* Using the default random bytes generator, this method is suitable for cryptographic use.
*
* @psalm-param (callable(int): string)|null $randomBytesGenerator
*
* @param BigNumber|int|float|string $min The lower bound. Must be convertible to a BigInteger.
* @param BigNumber|int|float|string $max The upper bound. Must be convertible to a BigInteger.
* @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer,
* and returns a string of random bytes of the given length.
* Defaults to the `random_bytes()` function.
*
* @throws MathException If one of the parameters cannot be converted to a BigInteger,
* or `$min` is greater than `$max`.
*/
public static function randomRange(
BigNumber|int|float|string $min,
BigNumber|int|float|string $max,
?callable $randomBytesGenerator = null
) : BigInteger {
$min = BigInteger::of($min);
$max = BigInteger::of($max);
if ($min->isGreaterThan($max)) {
throw new MathException('$min cannot be greater than $max.');
}
if ($min->isEqualTo($max)) {
return $min;
}
$diff = $max->minus($min);
$bitLength = $diff->getBitLength();
// try until the number is in range (50% to 100% chance of success)
do {
$randomNumber = self::randomBits($bitLength, $randomBytesGenerator);
} while ($randomNumber->isGreaterThan($diff));
return $randomNumber->plus($min);
}
/**
* Returns a BigInteger representing zero.
*
* @psalm-pure
*/
public static function zero() : BigInteger
{
/**
* @psalm-suppress ImpureStaticVariable
* @var BigInteger|null $zero
*/
static $zero;
if ($zero === null) {
$zero = new BigInteger('0');
}
return $zero;
}
/**
* Returns a BigInteger representing one.
*
* @psalm-pure
*/
public static function one() : BigInteger
{
/**
* @psalm-suppress ImpureStaticVariable
* @var BigInteger|null $one
*/
static $one;
if ($one === null) {
$one = new BigInteger('1');
}
return $one;
}
/**
* Returns a BigInteger representing ten.
*
* @psalm-pure
*/
public static function ten() : BigInteger
{
/**
* @psalm-suppress ImpureStaticVariable
* @var BigInteger|null $ten
*/
static $ten;
if ($ten === null) {
$ten = new BigInteger('10');
}
return $ten;
}
public static function gcdMultiple(BigInteger $a, BigInteger ...$n): BigInteger
{
$result = $a;
foreach ($n as $next) {
$result = $result->gcd($next);
if ($result->isEqualTo(1)) {
return $result;
}
}
return $result;
}
/**
* Returns the sum of this number and the given one.
*
* @param BigNumber|int|float|string $that The number to add. Must be convertible to a BigInteger.
*
* @throws MathException If the number is not valid, or is not convertible to a BigInteger.
*/
public function plus(BigNumber|int|float|string $that) : BigInteger
{
$that = BigInteger::of($that);
if ($that->value === '0') {
return $this;
}
if ($this->value === '0') {
return $that;
}
$value = Calculator::get()->add($this->value, $that->value);
return new BigInteger($value);
}
/**
* Returns the difference of this number and the given one.
*
* @param BigNumber|int|float|string $that The number to subtract. Must be convertible to a BigInteger.
*
* @throws MathException If the number is not valid, or is not convertible to a BigInteger.
*/
public function minus(BigNumber|int|float|string $that) : BigInteger
{
$that = BigInteger::of($that);
if ($that->value === '0') {
return $this;
}
$value = Calculator::get()->sub($this->value, $that->value);
return new BigInteger($value);
}
/**
* Returns the product of this number and the given one.
*
* @param BigNumber|int|float|string $that The multiplier. Must be convertible to a BigInteger.
*
* @throws MathException If the multiplier is not a valid number, or is not convertible to a BigInteger.
*/
public function multipliedBy(BigNumber|int|float|string $that) : BigInteger
{
$that = BigInteger::of($that);
if ($that->value === '1') {
return $this;
}
if ($this->value === '1') {
return $that;
}
$value = Calculator::get()->mul($this->value, $that->value);
return new BigInteger($value);
}
/**
* Returns the result of the division of this number by the given one.
*
* @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger.
* @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY.
*
* @throws MathException If the divisor is not a valid number, is not convertible to a BigInteger, is zero,
* or RoundingMode::UNNECESSARY is used and the remainder is not zero.
*/
public function dividedBy(BigNumber|int|float|string $that, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigInteger
{
$that = BigInteger::of($that);
if ($that->value === '1') {
return $this;
}
if ($that->value === '0') {
throw DivisionByZeroException::divisionByZero();
}
$result = Calculator::get()->divRound($this->value, $that->value, $roundingMode);
return new BigInteger($result);
}
/**
* Returns this number exponentiated to the given value.
*
* @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000.
*/
public function power(int $exponent) : BigInteger
{
if ($exponent === 0) {
return BigInteger::one();
}
if ($exponent === 1) {
return $this;
}
if ($exponent < 0 || $exponent > Calculator::MAX_POWER) {
throw new \InvalidArgumentException(\sprintf(
'The exponent %d is not in the range 0 to %d.',
$exponent,
Calculator::MAX_POWER
));
}
return new BigInteger(Calculator::get()->pow($this->value, $exponent));
}
/**
* Returns the quotient of the division of this number by the given one.
*
* @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger.
*
* @throws DivisionByZeroException If the divisor is zero.
*/
public function quotient(BigNumber|int|float|string $that) : BigInteger
{
$that = BigInteger::of($that);
if ($that->value === '1') {
return $this;
}
if ($that->value === '0') {
throw DivisionByZeroException::divisionByZero();
}
$quotient = Calculator::get()->divQ($this->value, $that->value);
return new BigInteger($quotient);
}
/**
* Returns the remainder of the division of this number by the given one.
*
* The remainder, when non-zero, has the same sign as the dividend.
*
* @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger.
*
* @throws DivisionByZeroException If the divisor is zero.
*/
public function remainder(BigNumber|int|float|string $that) : BigInteger
{
$that = BigInteger::of($that);
if ($that->value === '1') {
return BigInteger::zero();
}
if ($that->value === '0') {
throw DivisionByZeroException::divisionByZero();
}
$remainder = Calculator::get()->divR($this->value, $that->value);
return new BigInteger($remainder);
}
/**
* Returns the quotient and remainder of the division of this number by the given one.
*
* @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger.
*
* @return BigInteger[] An array containing the quotient and the remainder.
*
* @psalm-return array{BigInteger, BigInteger}
*
* @throws DivisionByZeroException If the divisor is zero.
*/
public function quotientAndRemainder(BigNumber|int|float|string $that) : array
{
$that = BigInteger::of($that);
if ($that->value === '0') {
throw DivisionByZeroException::divisionByZero();
}
[$quotient, $remainder] = Calculator::get()->divQR($this->value, $that->value);
return [
new BigInteger($quotient),
new BigInteger($remainder)
];
}
/**
* Returns the modulo of this number and the given one.
*
* The modulo operation yields the same result as the remainder operation when both operands are of the same sign,
* and may differ when signs are different.
*
* The result of the modulo operation, when non-zero, has the same sign as the divisor.
*
* @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger.
*
* @throws DivisionByZeroException If the divisor is zero.
*/
public function mod(BigNumber|int|float|string $that) : BigInteger
{
$that = BigInteger::of($that);
if ($that->value === '0') {
throw DivisionByZeroException::modulusMustNotBeZero();
}
$value = Calculator::get()->mod($this->value, $that->value);
return new BigInteger($value);
}
/**
* Returns the modular multiplicative inverse of this BigInteger modulo $m.
*
* @throws DivisionByZeroException If $m is zero.
* @throws NegativeNumberException If $m is negative.
* @throws MathException If this BigInteger has no multiplicative inverse mod m (that is, this BigInteger
* is not relatively prime to m).
*/
public function modInverse(BigInteger $m) : BigInteger
{
if ($m->value === '0') {
throw DivisionByZeroException::modulusMustNotBeZero();
}
if ($m->isNegative()) {
throw new NegativeNumberException('Modulus must not be negative.');
}
if ($m->value === '1') {
return BigInteger::zero();
}
$value = Calculator::get()->modInverse($this->value, $m->value);
if ($value === null) {
throw new MathException('Unable to compute the modInverse for the given modulus.');
}
return new BigInteger($value);
}
/**
* Returns this number raised into power with modulo.
*
* This operation only works on positive numbers.
*
* @param BigNumber|int|float|string $exp The exponent. Must be positive or zero.
* @param BigNumber|int|float|string $mod The modulus. Must be strictly positive.
*
* @throws NegativeNumberException If any of the operands is negative.
* @throws DivisionByZeroException If the modulus is zero.
*/
public function modPow(BigNumber|int|float|string $exp, BigNumber|int|float|string $mod) : BigInteger
{
$exp = BigInteger::of($exp);
$mod = BigInteger::of($mod);
if ($this->isNegative() || $exp->isNegative() || $mod->isNegative()) {
throw new NegativeNumberException('The operands cannot be negative.');
}
if ($mod->isZero()) {
throw DivisionByZeroException::modulusMustNotBeZero();
}
$result = Calculator::get()->modPow($this->value, $exp->value, $mod->value);
return new BigInteger($result);
}
/**
* Returns the greatest common divisor of this number and the given one.
*
* The GCD is always positive, unless both operands are zero, in which case it is zero.
*
* @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number.
*/
public function gcd(BigNumber|int|float|string $that) : BigInteger
{
$that = BigInteger::of($that);
if ($that->value === '0' && $this->value[0] !== '-') {
return $this;
}
if ($this->value === '0' && $that->value[0] !== '-') {
return $that;
}
$value = Calculator::get()->gcd($this->value, $that->value);
return new BigInteger($value);
}
/**
* Returns the integer square root number of this number, rounded down.
*
* The result is the largest x such that x² ≤ n.
*
* @throws NegativeNumberException If this number is negative.
*/
public function sqrt() : BigInteger
{
if ($this->value[0] === '-') {
throw new NegativeNumberException('Cannot calculate the square root of a negative number.');
}
$value = Calculator::get()->sqrt($this->value);
return new BigInteger($value);
}
/**
* Returns the absolute value of this number.
*/
public function abs() : BigInteger
{
return $this->isNegative() ? $this->negated() : $this;
}
/**
* Returns the inverse of this number.
*/
public function negated() : BigInteger
{
return new BigInteger(Calculator::get()->neg($this->value));
}
/**
* Returns the integer bitwise-and combined with another integer.
*
* This method returns a negative BigInteger if and only if both operands are negative.
*
* @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number.
*/
public function and(BigNumber|int|float|string $that) : BigInteger
{
$that = BigInteger::of($that);
return new BigInteger(Calculator::get()->and($this->value, $that->value));
}
/**
* Returns the integer bitwise-or combined with another integer.
*
* This method returns a negative BigInteger if and only if either of the operands is negative.
*
* @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number.
*/
public function or(BigNumber|int|float|string $that) : BigInteger
{
$that = BigInteger::of($that);
return new BigInteger(Calculator::get()->or($this->value, $that->value));
}
/**
* Returns the integer bitwise-xor combined with another integer.
*
* This method returns a negative BigInteger if and only if exactly one of the operands is negative.
*
* @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number.
*/
public function xor(BigNumber|int|float|string $that) : BigInteger
{
$that = BigInteger::of($that);
return new BigInteger(Calculator::get()->xor($this->value, $that->value));
}
/**
* Returns the bitwise-not of this BigInteger.
*/
public function not() : BigInteger
{
return $this->negated()->minus(1);
}
/**
* Returns the integer left shifted by a given number of bits.
*/
public function shiftedLeft(int $distance) : BigInteger
{
if ($distance === 0) {
return $this;
}
if ($distance < 0) {
return $this->shiftedRight(- $distance);
}
return $this->multipliedBy(BigInteger::of(2)->power($distance));
}
/**
* Returns the integer right shifted by a given number of bits.
*/
public function shiftedRight(int $distance) : BigInteger
{
if ($distance === 0) {
return $this;
}
if ($distance < 0) {
return $this->shiftedLeft(- $distance);
}
$operand = BigInteger::of(2)->power($distance);
if ($this->isPositiveOrZero()) {
return $this->quotient($operand);
}
return $this->dividedBy($operand, RoundingMode::UP);
}
/**
* Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit.
*
* For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation.
* Computes (ceil(log2(this < 0 ? -this : this+1))).
*/
public function getBitLength() : int
{
if ($this->value === '0') {
return 0;
}
if ($this->isNegative()) {
return $this->abs()->minus(1)->getBitLength();
}
return \strlen($this->toBase(2));
}
/**
* Returns the index of the rightmost (lowest-order) one bit in this BigInteger.
*
* Returns -1 if this BigInteger contains no one bits.
*/
public function getLowestSetBit() : int
{
$n = $this;
$bitLength = $this->getBitLength();
for ($i = 0; $i <= $bitLength; $i++) {
if ($n->isOdd()) {
return $i;
}
$n = $n->shiftedRight(1);
}
return -1;
}
/**
* Returns whether this number is even.
*/
public function isEven() : bool
{
return \in_array($this->value[-1], ['0', '2', '4', '6', '8'], true);
}
/**
* Returns whether this number is odd.
*/
public function isOdd() : bool
{
return \in_array($this->value[-1], ['1', '3', '5', '7', '9'], true);
}
/**
* Returns true if and only if the designated bit is set.
*
* Computes ((this & (1<shiftedRight($n)->isOdd();
}
#[Override]
public function compareTo(BigNumber|int|float|string $that) : int
{
$that = BigNumber::of($that);
if ($that instanceof BigInteger) {
return Calculator::get()->cmp($this->value, $that->value);
}
return - $that->compareTo($this);
}
#[Override]
public function getSign() : int
{
return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1);
}
#[Override]
public function toBigInteger() : BigInteger
{
return $this;
}
#[Override]
public function toBigDecimal() : BigDecimal
{
return self::newBigDecimal($this->value);
}
#[Override]
public function toBigRational() : BigRational
{
return self::newBigRational($this, BigInteger::one(), false);
}
#[Override]
public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
{
return $this->toBigDecimal()->toScale($scale, $roundingMode);
}
#[Override]
public function toInt() : int
{
$intValue = (int) $this->value;
if ($this->value !== (string) $intValue) {
throw IntegerOverflowException::toIntOverflow($this);
}
return $intValue;
}
#[Override]
public function toFloat() : float
{
return (float) $this->value;
}
/**
* Returns a string representation of this number in the given base.
*
* The output will always be lowercase for bases greater than 10.
*
* @throws \InvalidArgumentException If the base is out of range.
*/
public function toBase(int $base) : string
{
if ($base === 10) {
return $this->value;
}
if ($base < 2 || $base > 36) {
throw new \InvalidArgumentException(\sprintf('Base %d is out of range [2, 36]', $base));
}
return Calculator::get()->toBase($this->value, $base);
}
/**
* Returns a string representation of this number in an arbitrary base with a custom alphabet.
*
* Because this method accepts an alphabet with any character, including dash, it does not handle negative numbers;
* a NegativeNumberException will be thrown when attempting to call this method on a negative number.
*
* @param string $alphabet The alphabet, for example '01' for base 2, or '01234567' for base 8.
*
* @throws NegativeNumberException If this number is negative.
* @throws \InvalidArgumentException If the given alphabet does not contain at least 2 chars.
*/
public function toArbitraryBase(string $alphabet) : string
{
$base = \strlen($alphabet);
if ($base < 2) {
throw new \InvalidArgumentException('The alphabet must contain at least 2 chars.');
}
if ($this->value[0] === '-') {
throw new NegativeNumberException(__FUNCTION__ . '() does not support negative numbers.');
}
return Calculator::get()->toArbitraryBase($this->value, $alphabet, $base);
}
/**
* Returns a string of bytes containing the binary representation of this BigInteger.
*
* The string is in big-endian byte-order: the most significant byte is in the zeroth element.
*
* If `$signed` is true, the output will be in two's-complement representation, and a sign bit will be prepended to
* the output. If `$signed` is false, no sign bit will be prepended, and this method will throw an exception if the
* number is negative.
*
* The string will contain the minimum number of bytes required to represent this BigInteger, including a sign bit
* if `$signed` is true.
*
* This representation is compatible with the `fromBytes()` factory method, as long as the `$signed` flags match.
*
* @param bool $signed Whether to output a signed number in two's-complement representation with a leading sign bit.
*
* @throws NegativeNumberException If $signed is false, and the number is negative.
*/
public function toBytes(bool $signed = true) : string
{
if (! $signed && $this->isNegative()) {
throw new NegativeNumberException('Cannot convert a negative number to a byte string when $signed is false.');
}
$hex = $this->abs()->toBase(16);
if (\strlen($hex) % 2 !== 0) {
$hex = '0' . $hex;
}
$baseHexLength = \strlen($hex);
if ($signed) {
if ($this->isNegative()) {
$bin = \hex2bin($hex);
assert($bin !== false);
$hex = \bin2hex(~$bin);
$hex = self::fromBase($hex, 16)->plus(1)->toBase(16);
$hexLength = \strlen($hex);
if ($hexLength < $baseHexLength) {
$hex = \str_repeat('0', $baseHexLength - $hexLength) . $hex;
}
if ($hex[0] < '8') {
$hex = 'FF' . $hex;
}
} else {
if ($hex[0] >= '8') {
$hex = '00' . $hex;
}
}
}
return \hex2bin($hex);
}
/**
* @return numeric-string
*/
#[Override]
public function __toString() : string
{
/** @var numeric-string */
return $this->value;
}
/**
* This method is required for serializing the object and SHOULD NOT be accessed directly.
*
* @internal
*
* @return array{value: string}
*/
public function __serialize(): array
{
return ['value' => $this->value];
}
/**
* This method is only here to allow unserializing the object and cannot be accessed directly.
*
* @internal
* @psalm-suppress RedundantPropertyInitializationCheck
*
* @param array{value: string} $data
*
* @throws \LogicException
*/
public function __unserialize(array $data): void
{
if (isset($this->value)) {
throw new \LogicException('__unserialize() is an internal function, it must not be called directly.');
}
$this->value = $data['value'];
}
}
================================================
FILE: lib/Google/vendor/brick/math/src/BigNumber.php
================================================
[\-\+])?' .
'(?[0-9]+)?' .
'(?\.)?' .
'(?[0-9]+)?' .
'(?:[eE](?[\-\+]?[0-9]+))?' .
'$/';
/**
* The regular expression used to parse rational numbers.
*/
private const PARSE_REGEXP_RATIONAL =
'/^' .
'(?[\-\+])?' .
'(?[0-9]+)' .
'\/?' .
'(?[0-9]+)' .
'$/';
/**
* Creates a BigNumber of the given value.
*
* The concrete return type is dependent on the given value, with the following rules:
*
* - BigNumber instances are returned as is
* - integer numbers are returned as BigInteger
* - floating point numbers are converted to a string then parsed as such
* - strings containing a `/` character are returned as BigRational
* - strings containing a `.` character or using an exponential notation are returned as BigDecimal
* - strings containing only digits with an optional leading `+` or `-` sign are returned as BigInteger
*
* @throws NumberFormatException If the format of the number is not valid.
* @throws DivisionByZeroException If the value represents a rational number with a denominator of zero.
* @throws RoundingNecessaryException If the value cannot be converted to an instance of the subclass without rounding.
*
* @psalm-pure
*/
final public static function of(BigNumber|int|float|string $value) : static
{
$value = self::_of($value);
if (static::class === BigNumber::class) {
// https://github.com/vimeo/psalm/issues/10309
assert($value instanceof static);
return $value;
}
return static::from($value);
}
/**
* @throws NumberFormatException If the format of the number is not valid.
* @throws DivisionByZeroException If the value represents a rational number with a denominator of zero.
*
* @psalm-pure
*/
private static function _of(BigNumber|int|float|string $value) : BigNumber
{
if ($value instanceof BigNumber) {
return $value;
}
if (\is_int($value)) {
return new BigInteger((string) $value);
}
if (is_float($value)) {
$value = (string) $value;
}
if (str_contains($value, '/')) {
// Rational number
if (\preg_match(self::PARSE_REGEXP_RATIONAL, $value, $matches, PREG_UNMATCHED_AS_NULL) !== 1) {
throw NumberFormatException::invalidFormat($value);
}
$sign = $matches['sign'];
$numerator = $matches['numerator'];
$denominator = $matches['denominator'];
assert($numerator !== null);
assert($denominator !== null);
$numerator = self::cleanUp($sign, $numerator);
$denominator = self::cleanUp(null, $denominator);
if ($denominator === '0') {
throw DivisionByZeroException::denominatorMustNotBeZero();
}
return new BigRational(
new BigInteger($numerator),
new BigInteger($denominator),
false
);
} else {
// Integer or decimal number
if (\preg_match(self::PARSE_REGEXP_NUMERICAL, $value, $matches, PREG_UNMATCHED_AS_NULL) !== 1) {
throw NumberFormatException::invalidFormat($value);
}
$sign = $matches['sign'];
$point = $matches['point'];
$integral = $matches['integral'];
$fractional = $matches['fractional'];
$exponent = $matches['exponent'];
if ($integral === null && $fractional === null) {
throw NumberFormatException::invalidFormat($value);
}
if ($integral === null) {
$integral = '0';
}
if ($point !== null || $exponent !== null) {
$fractional = ($fractional ?? '');
$exponent = ($exponent !== null) ? (int)$exponent : 0;
if ($exponent === PHP_INT_MIN || $exponent === PHP_INT_MAX) {
throw new NumberFormatException('Exponent too large.');
}
$unscaledValue = self::cleanUp($sign, $integral . $fractional);
$scale = \strlen($fractional) - $exponent;
if ($scale < 0) {
if ($unscaledValue !== '0') {
$unscaledValue .= \str_repeat('0', -$scale);
}
$scale = 0;
}
return new BigDecimal($unscaledValue, $scale);
}
$integral = self::cleanUp($sign, $integral);
return new BigInteger($integral);
}
}
/**
* Overridden by subclasses to convert a BigNumber to an instance of the subclass.
*
* @throws RoundingNecessaryException If the value cannot be converted.
*
* @psalm-pure
*/
abstract protected static function from(BigNumber $number): static;
/**
* Proxy method to access BigInteger's protected constructor from sibling classes.
*
* @internal
* @psalm-pure
*/
final protected function newBigInteger(string $value) : BigInteger
{
return new BigInteger($value);
}
/**
* Proxy method to access BigDecimal's protected constructor from sibling classes.
*
* @internal
* @psalm-pure
*/
final protected function newBigDecimal(string $value, int $scale = 0) : BigDecimal
{
return new BigDecimal($value, $scale);
}
/**
* Proxy method to access BigRational's protected constructor from sibling classes.
*
* @internal
* @psalm-pure
*/
final protected function newBigRational(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) : BigRational
{
return new BigRational($numerator, $denominator, $checkDenominator);
}
/**
* Returns the minimum of the given values.
*
* @param BigNumber|int|float|string ...$values The numbers to compare. All the numbers need to be convertible
* to an instance of the class this method is called on.
*
* @throws \InvalidArgumentException If no values are given.
* @throws MathException If an argument is not valid.
*
* @psalm-pure
*/
final public static function min(BigNumber|int|float|string ...$values) : static
{
$min = null;
foreach ($values as $value) {
$value = static::of($value);
if ($min === null || $value->isLessThan($min)) {
$min = $value;
}
}
if ($min === null) {
throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.');
}
return $min;
}
/**
* Returns the maximum of the given values.
*
* @param BigNumber|int|float|string ...$values The numbers to compare. All the numbers need to be convertible
* to an instance of the class this method is called on.
*
* @throws \InvalidArgumentException If no values are given.
* @throws MathException If an argument is not valid.
*
* @psalm-pure
*/
final public static function max(BigNumber|int|float|string ...$values) : static
{
$max = null;
foreach ($values as $value) {
$value = static::of($value);
if ($max === null || $value->isGreaterThan($max)) {
$max = $value;
}
}
if ($max === null) {
throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.');
}
return $max;
}
/**
* Returns the sum of the given values.
*
* @param BigNumber|int|float|string ...$values The numbers to add. All the numbers need to be convertible
* to an instance of the class this method is called on.
*
* @throws \InvalidArgumentException If no values are given.
* @throws MathException If an argument is not valid.
*
* @psalm-pure
*/
final public static function sum(BigNumber|int|float|string ...$values) : static
{
/** @var static|null $sum */
$sum = null;
foreach ($values as $value) {
$value = static::of($value);
$sum = $sum === null ? $value : self::add($sum, $value);
}
if ($sum === null) {
throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.');
}
return $sum;
}
/**
* Adds two BigNumber instances in the correct order to avoid a RoundingNecessaryException.
*
* @todo This could be better resolved by creating an abstract protected method in BigNumber, and leaving to
* concrete classes the responsibility to perform the addition themselves or delegate it to the given number,
* depending on their ability to perform the operation. This will also require a version bump because we're
* potentially breaking custom BigNumber implementations (if any...)
*
* @psalm-pure
*/
private static function add(BigNumber $a, BigNumber $b) : BigNumber
{
if ($a instanceof BigRational) {
return $a->plus($b);
}
if ($b instanceof BigRational) {
return $b->plus($a);
}
if ($a instanceof BigDecimal) {
return $a->plus($b);
}
if ($b instanceof BigDecimal) {
return $b->plus($a);
}
/** @var BigInteger $a */
return $a->plus($b);
}
/**
* Removes optional leading zeros and applies sign.
*
* @param string|null $sign The sign, '+' or '-', optional. Null is allowed for convenience and treated as '+'.
* @param string $number The number, validated as a non-empty string of digits.
*
* @psalm-pure
*/
private static function cleanUp(string|null $sign, string $number) : string
{
$number = \ltrim($number, '0');
if ($number === '') {
return '0';
}
return $sign === '-' ? '-' . $number : $number;
}
/**
* Checks if this number is equal to the given one.
*/
final public function isEqualTo(BigNumber|int|float|string $that) : bool
{
return $this->compareTo($that) === 0;
}
/**
* Checks if this number is strictly lower than the given one.
*/
final public function isLessThan(BigNumber|int|float|string $that) : bool
{
return $this->compareTo($that) < 0;
}
/**
* Checks if this number is lower than or equal to the given one.
*/
final public function isLessThanOrEqualTo(BigNumber|int|float|string $that) : bool
{
return $this->compareTo($that) <= 0;
}
/**
* Checks if this number is strictly greater than the given one.
*/
final public function isGreaterThan(BigNumber|int|float|string $that) : bool
{
return $this->compareTo($that) > 0;
}
/**
* Checks if this number is greater than or equal to the given one.
*/
final public function isGreaterThanOrEqualTo(BigNumber|int|float|string $that) : bool
{
return $this->compareTo($that) >= 0;
}
/**
* Checks if this number equals zero.
*/
final public function isZero() : bool
{
return $this->getSign() === 0;
}
/**
* Checks if this number is strictly negative.
*/
final public function isNegative() : bool
{
return $this->getSign() < 0;
}
/**
* Checks if this number is negative or zero.
*/
final public function isNegativeOrZero() : bool
{
return $this->getSign() <= 0;
}
/**
* Checks if this number is strictly positive.
*/
final public function isPositive() : bool
{
return $this->getSign() > 0;
}
/**
* Checks if this number is positive or zero.
*/
final public function isPositiveOrZero() : bool
{
return $this->getSign() >= 0;
}
/**
* Returns the sign of this number.
*
* @psalm-return -1|0|1
*
* @return int -1 if the number is negative, 0 if zero, 1 if positive.
*/
abstract public function getSign() : int;
/**
* Compares this number to the given one.
*
* @psalm-return -1|0|1
*
* @return int -1 if `$this` is lower than, 0 if equal to, 1 if greater than `$that`.
*
* @throws MathException If the number is not valid.
*/
abstract public function compareTo(BigNumber|int|float|string $that) : int;
/**
* Converts this number to a BigInteger.
*
* @throws RoundingNecessaryException If this number cannot be converted to a BigInteger without rounding.
*/
abstract public function toBigInteger() : BigInteger;
/**
* Converts this number to a BigDecimal.
*
* @throws RoundingNecessaryException If this number cannot be converted to a BigDecimal without rounding.
*/
abstract public function toBigDecimal() : BigDecimal;
/**
* Converts this number to a BigRational.
*/
abstract public function toBigRational() : BigRational;
/**
* Converts this number to a BigDecimal with the given scale, using rounding if necessary.
*
* @param int $scale The scale of the resulting `BigDecimal`.
* @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY.
*
* @throws RoundingNecessaryException If this number cannot be converted to the given scale without rounding.
* This only applies when RoundingMode::UNNECESSARY is used.
*/
abstract public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal;
/**
* Returns the exact value of this number as a native integer.
*
* If this number cannot be converted to a native integer without losing precision, an exception is thrown.
* Note that the acceptable range for an integer depends on the platform and differs for 32-bit and 64-bit.
*
* @throws MathException If this number cannot be exactly converted to a native integer.
*/
abstract public function toInt() : int;
/**
* Returns an approximation of this number as a floating-point value.
*
* Note that this method can discard information as the precision of a floating-point value
* is inherently limited.
*
* If the number is greater than the largest representable floating point number, positive infinity is returned.
* If the number is less than the smallest representable floating point number, negative infinity is returned.
*/
abstract public function toFloat() : float;
/**
* Returns a string representation of this number.
*
* The output of this method can be parsed by the `of()` factory method;
* this will yield an object equal to this one, without any information loss.
*/
abstract public function __toString() : string;
#[Override]
final public function jsonSerialize() : string
{
return $this->__toString();
}
}
================================================
FILE: lib/Google/vendor/brick/math/src/BigRational.php
================================================
isZero()) {
throw DivisionByZeroException::denominatorMustNotBeZero();
}
if ($denominator->isNegative()) {
$numerator = $numerator->negated();
$denominator = $denominator->negated();
}
}
$this->numerator = $numerator;
$this->denominator = $denominator;
}
/**
* @psalm-pure
*/
#[Override]
protected static function from(BigNumber $number): static
{
return $number->toBigRational();
}
/**
* Creates a BigRational out of a numerator and a denominator.
*
* If the denominator is negative, the signs of both the numerator and the denominator
* will be inverted to ensure that the denominator is always positive.
*
* @param BigNumber|int|float|string $numerator The numerator. Must be convertible to a BigInteger.
* @param BigNumber|int|float|string $denominator The denominator. Must be convertible to a BigInteger.
*
* @throws NumberFormatException If an argument does not represent a valid number.
* @throws RoundingNecessaryException If an argument represents a non-integer number.
* @throws DivisionByZeroException If the denominator is zero.
*
* @psalm-pure
*/
public static function nd(
BigNumber|int|float|string $numerator,
BigNumber|int|float|string $denominator,
) : BigRational {
$numerator = BigInteger::of($numerator);
$denominator = BigInteger::of($denominator);
return new BigRational($numerator, $denominator, true);
}
/**
* Returns a BigRational representing zero.
*
* @psalm-pure
*/
public static function zero() : BigRational
{
/**
* @psalm-suppress ImpureStaticVariable
* @var BigRational|null $zero
*/
static $zero;
if ($zero === null) {
$zero = new BigRational(BigInteger::zero(), BigInteger::one(), false);
}
return $zero;
}
/**
* Returns a BigRational representing one.
*
* @psalm-pure
*/
public static function one() : BigRational
{
/**
* @psalm-suppress ImpureStaticVariable
* @var BigRational|null $one
*/
static $one;
if ($one === null) {
$one = new BigRational(BigInteger::one(), BigInteger::one(), false);
}
return $one;
}
/**
* Returns a BigRational representing ten.
*
* @psalm-pure
*/
public static function ten() : BigRational
{
/**
* @psalm-suppress ImpureStaticVariable
* @var BigRational|null $ten
*/
static $ten;
if ($ten === null) {
$ten = new BigRational(BigInteger::ten(), BigInteger::one(), false);
}
return $ten;
}
public function getNumerator() : BigInteger
{
return $this->numerator;
}
public function getDenominator() : BigInteger
{
return $this->denominator;
}
/**
* Returns the quotient of the division of the numerator by the denominator.
*/
public function quotient() : BigInteger
{
return $this->numerator->quotient($this->denominator);
}
/**
* Returns the remainder of the division of the numerator by the denominator.
*/
public function remainder() : BigInteger
{
return $this->numerator->remainder($this->denominator);
}
/**
* Returns the quotient and remainder of the division of the numerator by the denominator.
*
* @return BigInteger[]
*
* @psalm-return array{BigInteger, BigInteger}
*/
public function quotientAndRemainder() : array
{
return $this->numerator->quotientAndRemainder($this->denominator);
}
/**
* Returns the sum of this number and the given one.
*
* @param BigNumber|int|float|string $that The number to add.
*
* @throws MathException If the number is not valid.
*/
public function plus(BigNumber|int|float|string $that) : BigRational
{
$that = BigRational::of($that);
$numerator = $this->numerator->multipliedBy($that->denominator);
$numerator = $numerator->plus($that->numerator->multipliedBy($this->denominator));
$denominator = $this->denominator->multipliedBy($that->denominator);
return new BigRational($numerator, $denominator, false);
}
/**
* Returns the difference of this number and the given one.
*
* @param BigNumber|int|float|string $that The number to subtract.
*
* @throws MathException If the number is not valid.
*/
public function minus(BigNumber|int|float|string $that) : BigRational
{
$that = BigRational::of($that);
$numerator = $this->numerator->multipliedBy($that->denominator);
$numerator = $numerator->minus($that->numerator->multipliedBy($this->denominator));
$denominator = $this->denominator->multipliedBy($that->denominator);
return new BigRational($numerator, $denominator, false);
}
/**
* Returns the product of this number and the given one.
*
* @param BigNumber|int|float|string $that The multiplier.
*
* @throws MathException If the multiplier is not a valid number.
*/
public function multipliedBy(BigNumber|int|float|string $that) : BigRational
{
$that = BigRational::of($that);
$numerator = $this->numerator->multipliedBy($that->numerator);
$denominator = $this->denominator->multipliedBy($that->denominator);
return new BigRational($numerator, $denominator, false);
}
/**
* Returns the result of the division of this number by the given one.
*
* @param BigNumber|int|float|string $that The divisor.
*
* @throws MathException If the divisor is not a valid number, or is zero.
*/
public function dividedBy(BigNumber|int|float|string $that) : BigRational
{
$that = BigRational::of($that);
$numerator = $this->numerator->multipliedBy($that->denominator);
$denominator = $this->denominator->multipliedBy($that->numerator);
return new BigRational($numerator, $denominator, true);
}
/**
* Returns this number exponentiated to the given value.
*
* @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000.
*/
public function power(int $exponent) : BigRational
{
if ($exponent === 0) {
$one = BigInteger::one();
return new BigRational($one, $one, false);
}
if ($exponent === 1) {
return $this;
}
return new BigRational(
$this->numerator->power($exponent),
$this->denominator->power($exponent),
false
);
}
/**
* Returns the reciprocal of this BigRational.
*
* The reciprocal has the numerator and denominator swapped.
*
* @throws DivisionByZeroException If the numerator is zero.
*/
public function reciprocal() : BigRational
{
return new BigRational($this->denominator, $this->numerator, true);
}
/**
* Returns the absolute value of this BigRational.
*/
public function abs() : BigRational
{
return new BigRational($this->numerator->abs(), $this->denominator, false);
}
/**
* Returns the negated value of this BigRational.
*/
public function negated() : BigRational
{
return new BigRational($this->numerator->negated(), $this->denominator, false);
}
/**
* Returns the simplified value of this BigRational.
*/
public function simplified() : BigRational
{
$gcd = $this->numerator->gcd($this->denominator);
$numerator = $this->numerator->quotient($gcd);
$denominator = $this->denominator->quotient($gcd);
return new BigRational($numerator, $denominator, false);
}
#[Override]
public function compareTo(BigNumber|int|float|string $that) : int
{
return $this->minus($that)->getSign();
}
#[Override]
public function getSign() : int
{
return $this->numerator->getSign();
}
#[Override]
public function toBigInteger() : BigInteger
{
$simplified = $this->simplified();
if (! $simplified->denominator->isEqualTo(1)) {
throw new RoundingNecessaryException('This rational number cannot be represented as an integer value without rounding.');
}
return $simplified->numerator;
}
#[Override]
public function toBigDecimal() : BigDecimal
{
return $this->numerator->toBigDecimal()->exactlyDividedBy($this->denominator);
}
#[Override]
public function toBigRational() : BigRational
{
return $this;
}
#[Override]
public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
{
return $this->numerator->toBigDecimal()->dividedBy($this->denominator, $scale, $roundingMode);
}
#[Override]
public function toInt() : int
{
return $this->toBigInteger()->toInt();
}
#[Override]
public function toFloat() : float
{
$simplified = $this->simplified();
return $simplified->numerator->toFloat() / $simplified->denominator->toFloat();
}
#[Override]
public function __toString() : string
{
$numerator = (string) $this->numerator;
$denominator = (string) $this->denominator;
if ($denominator === '1') {
return $numerator;
}
return $numerator . '/' . $denominator;
}
/**
* This method is required for serializing the object and SHOULD NOT be accessed directly.
*
* @internal
*
* @return array{numerator: BigInteger, denominator: BigInteger}
*/
public function __serialize(): array
{
return ['numerator' => $this->numerator, 'denominator' => $this->denominator];
}
/**
* This method is only here to allow unserializing the object and cannot be accessed directly.
*
* @internal
* @psalm-suppress RedundantPropertyInitializationCheck
*
* @param array{numerator: BigInteger, denominator: BigInteger} $data
*
* @throws \LogicException
*/
public function __unserialize(array $data): void
{
if (isset($this->numerator)) {
throw new \LogicException('__unserialize() is an internal function, it must not be called directly.');
}
$this->numerator = $data['numerator'];
$this->denominator = $data['denominator'];
}
}
================================================
FILE: lib/Google/vendor/brick/math/src/Exception/DivisionByZeroException.php
================================================
126) {
$char = \strtoupper(\dechex($ord));
if ($ord < 10) {
$char = '0' . $char;
}
} else {
$char = '"' . $char . '"';
}
return new self(\sprintf('Char %s is not a valid character in the given alphabet.', $char));
}
}
================================================
FILE: lib/Google/vendor/brick/math/src/Exception/RoundingNecessaryException.php
================================================
maxDigits = match (PHP_INT_SIZE) {
4 => 9,
8 => 18,
default => throw new \RuntimeException('The platform is not 32-bit or 64-bit as expected.')
};
}
#[Override]
public function add(string $a, string $b) : string
{
/**
* @psalm-var numeric-string $a
* @psalm-var numeric-string $b
*/
$result = $a + $b;
if (is_int($result)) {
return (string) $result;
}
if ($a === '0') {
return $b;
}
if ($b === '0') {
return $a;
}
[$aNeg, $bNeg, $aDig, $bDig] = $this->init($a, $b);
$result = $aNeg === $bNeg ? $this->doAdd($aDig, $bDig) : $this->doSub($aDig, $bDig);
if ($aNeg) {
$result = $this->neg($result);
}
return $result;
}
#[Override]
public function sub(string $a, string $b) : string
{
return $this->add($a, $this->neg($b));
}
#[Override]
public function mul(string $a, string $b) : string
{
/**
* @psalm-var numeric-string $a
* @psalm-var numeric-string $b
*/
$result = $a * $b;
if (is_int($result)) {
return (string) $result;
}
if ($a === '0' || $b === '0') {
return '0';
}
if ($a === '1') {
return $b;
}
if ($b === '1') {
return $a;
}
if ($a === '-1') {
return $this->neg($b);
}
if ($b === '-1') {
return $this->neg($a);
}
[$aNeg, $bNeg, $aDig, $bDig] = $this->init($a, $b);
$result = $this->doMul($aDig, $bDig);
if ($aNeg !== $bNeg) {
$result = $this->neg($result);
}
return $result;
}
#[Override]
public function divQ(string $a, string $b) : string
{
return $this->divQR($a, $b)[0];
}
#[Override]
public function divR(string $a, string $b): string
{
return $this->divQR($a, $b)[1];
}
#[Override]
public function divQR(string $a, string $b) : array
{
if ($a === '0') {
return ['0', '0'];
}
if ($a === $b) {
return ['1', '0'];
}
if ($b === '1') {
return [$a, '0'];
}
if ($b === '-1') {
return [$this->neg($a), '0'];
}
/** @psalm-var numeric-string $a */
$na = $a * 1; // cast to number
if (is_int($na)) {
/** @psalm-var numeric-string $b */
$nb = $b * 1;
if (is_int($nb)) {
// the only division that may overflow is PHP_INT_MIN / -1,
// which cannot happen here as we've already handled a divisor of -1 above.
$q = intdiv($na, $nb);
$r = $na % $nb;
return [
(string) $q,
(string) $r
];
}
}
[$aNeg, $bNeg, $aDig, $bDig] = $this->init($a, $b);
[$q, $r] = $this->doDiv($aDig, $bDig);
if ($aNeg !== $bNeg) {
$q = $this->neg($q);
}
if ($aNeg) {
$r = $this->neg($r);
}
return [$q, $r];
}
#[Override]
public function pow(string $a, int $e) : string
{
if ($e === 0) {
return '1';
}
if ($e === 1) {
return $a;
}
$odd = $e % 2;
$e -= $odd;
$aa = $this->mul($a, $a);
/** @psalm-suppress PossiblyInvalidArgument We're sure that $e / 2 is an int now */
$result = $this->pow($aa, $e / 2);
if ($odd === 1) {
$result = $this->mul($result, $a);
}
return $result;
}
/**
* Algorithm from: https://www.geeksforgeeks.org/modular-exponentiation-power-in-modular-arithmetic/
*/
#[Override]
public function modPow(string $base, string $exp, string $mod) : string
{
// special case: the algorithm below fails with 0 power 0 mod 1 (returns 1 instead of 0)
if ($base === '0' && $exp === '0' && $mod === '1') {
return '0';
}
// special case: the algorithm below fails with power 0 mod 1 (returns 1 instead of 0)
if ($exp === '0' && $mod === '1') {
return '0';
}
$x = $base;
$res = '1';
// numbers are positive, so we can use remainder instead of modulo
$x = $this->divR($x, $mod);
while ($exp !== '0') {
if (in_array($exp[-1], ['1', '3', '5', '7', '9'])) { // odd
$res = $this->divR($this->mul($res, $x), $mod);
}
$exp = $this->divQ($exp, '2');
$x = $this->divR($this->mul($x, $x), $mod);
}
return $res;
}
/**
* Adapted from https://cp-algorithms.com/num_methods/roots_newton.html
*/
#[Override]
public function sqrt(string $n) : string
{
if ($n === '0') {
return '0';
}
// initial approximation
$x = \str_repeat('9', \intdiv(\strlen($n), 2) ?: 1);
$decreased = false;
for (;;) {
$nx = $this->divQ($this->add($x, $this->divQ($n, $x)), '2');
if ($x === $nx || $this->cmp($nx, $x) > 0 && $decreased) {
break;
}
$decreased = $this->cmp($nx, $x) < 0;
$x = $nx;
}
return $x;
}
/**
* Performs the addition of two non-signed large integers.
*/
private function doAdd(string $a, string $b) : string
{
[$a, $b, $length] = $this->pad($a, $b);
$carry = 0;
$result = '';
for ($i = $length - $this->maxDigits;; $i -= $this->maxDigits) {
$blockLength = $this->maxDigits;
if ($i < 0) {
$blockLength += $i;
/** @psalm-suppress LoopInvalidation */
$i = 0;
}
/** @psalm-var numeric-string $blockA */
$blockA = \substr($a, $i, $blockLength);
/** @psalm-var numeric-string $blockB */
$blockB = \substr($b, $i, $blockLength);
$sum = (string) ($blockA + $blockB + $carry);
$sumLength = \strlen($sum);
if ($sumLength > $blockLength) {
$sum = \substr($sum, 1);
$carry = 1;
} else {
if ($sumLength < $blockLength) {
$sum = \str_repeat('0', $blockLength - $sumLength) . $sum;
}
$carry = 0;
}
$result = $sum . $result;
if ($i === 0) {
break;
}
}
if ($carry === 1) {
$result = '1' . $result;
}
return $result;
}
/**
* Performs the subtraction of two non-signed large integers.
*/
private function doSub(string $a, string $b) : string
{
if ($a === $b) {
return '0';
}
// Ensure that we always subtract to a positive result: biggest minus smallest.
$cmp = $this->doCmp($a, $b);
$invert = ($cmp === -1);
if ($invert) {
$c = $a;
$a = $b;
$b = $c;
}
[$a, $b, $length] = $this->pad($a, $b);
$carry = 0;
$result = '';
$complement = 10 ** $this->maxDigits;
for ($i = $length - $this->maxDigits;; $i -= $this->maxDigits) {
$blockLength = $this->maxDigits;
if ($i < 0) {
$blockLength += $i;
/** @psalm-suppress LoopInvalidation */
$i = 0;
}
/** @psalm-var numeric-string $blockA */
$blockA = \substr($a, $i, $blockLength);
/** @psalm-var numeric-string $blockB */
$blockB = \substr($b, $i, $blockLength);
$sum = $blockA - $blockB - $carry;
if ($sum < 0) {
$sum += $complement;
$carry = 1;
} else {
$carry = 0;
}
$sum = (string) $sum;
$sumLength = \strlen($sum);
if ($sumLength < $blockLength) {
$sum = \str_repeat('0', $blockLength - $sumLength) . $sum;
}
$result = $sum . $result;
if ($i === 0) {
break;
}
}
// Carry cannot be 1 when the loop ends, as a > b
assert($carry === 0);
$result = \ltrim($result, '0');
if ($invert) {
$result = $this->neg($result);
}
return $result;
}
/**
* Performs the multiplication of two non-signed large integers.
*/
private function doMul(string $a, string $b) : string
{
$x = \strlen($a);
$y = \strlen($b);
$maxDigits = \intdiv($this->maxDigits, 2);
$complement = 10 ** $maxDigits;
$result = '0';
for ($i = $x - $maxDigits;; $i -= $maxDigits) {
$blockALength = $maxDigits;
if ($i < 0) {
$blockALength += $i;
/** @psalm-suppress LoopInvalidation */
$i = 0;
}
$blockA = (int) \substr($a, $i, $blockALength);
$line = '';
$carry = 0;
for ($j = $y - $maxDigits;; $j -= $maxDigits) {
$blockBLength = $maxDigits;
if ($j < 0) {
$blockBLength += $j;
/** @psalm-suppress LoopInvalidation */
$j = 0;
}
$blockB = (int) \substr($b, $j, $blockBLength);
$mul = $blockA * $blockB + $carry;
$value = $mul % $complement;
$carry = ($mul - $value) / $complement;
$value = (string) $value;
$value = \str_pad($value, $maxDigits, '0', STR_PAD_LEFT);
$line = $value . $line;
if ($j === 0) {
break;
}
}
if ($carry !== 0) {
$line = $carry . $line;
}
$line = \ltrim($line, '0');
if ($line !== '') {
$line .= \str_repeat('0', $x - $blockALength - $i);
$result = $this->add($result, $line);
}
if ($i === 0) {
break;
}
}
return $result;
}
/**
* Performs the division of two non-signed large integers.
*
* @return string[] The quotient and remainder.
*/
private function doDiv(string $a, string $b) : array
{
$cmp = $this->doCmp($a, $b);
if ($cmp === -1) {
return ['0', $a];
}
$x = \strlen($a);
$y = \strlen($b);
// we now know that a >= b && x >= y
$q = '0'; // quotient
$r = $a; // remainder
$z = $y; // focus length, always $y or $y+1
/** @psalm-var numeric-string $b */
$nb = $b * 1; // cast to number
// performance optimization in cases where the remainder will never cause int overflow
if (is_int(($nb - 1) * 10 + 9)) {
$r = (int) \substr($a, 0, $z - 1);
for ($i = $z - 1; $i < $x; $i++) {
$n = $r * 10 + (int) $a[$i];
/** @psalm-var int $nb */
$q .= \intdiv($n, $nb);
$r = $n % $nb;
}
return [\ltrim($q, '0') ?: '0', (string) $r];
}
for (;;) {
$focus = \substr($a, 0, $z);
$cmp = $this->doCmp($focus, $b);
if ($cmp === -1) {
if ($z === $x) { // remainder < dividend
break;
}
$z++;
}
$zeros = \str_repeat('0', $x - $z);
$q = $this->add($q, '1' . $zeros);
$a = $this->sub($a, $b . $zeros);
$r = $a;
if ($r === '0') { // remainder == 0
break;
}
$x = \strlen($a);
if ($x < $y) { // remainder < dividend
break;
}
$z = $y;
}
return [$q, $r];
}
/**
* Compares two non-signed large numbers.
*
* @psalm-return -1|0|1
*/
private function doCmp(string $a, string $b) : int
{
$x = \strlen($a);
$y = \strlen($b);
$cmp = $x <=> $y;
if ($cmp !== 0) {
return $cmp;
}
return \strcmp($a, $b) <=> 0; // enforce -1|0|1
}
/**
* Pads the left of one of the given numbers with zeros if necessary to make both numbers the same length.
*
* The numbers must only consist of digits, without leading minus sign.
*
* @return array{string, string, int}
*/
private function pad(string $a, string $b) : array
{
$x = \strlen($a);
$y = \strlen($b);
if ($x > $y) {
$b = \str_repeat('0', $x - $y) . $b;
return [$a, $b, $x];
}
if ($x < $y) {
$a = \str_repeat('0', $y - $x) . $a;
return [$a, $b, $y];
}
return [$a, $b, $x];
}
}
================================================
FILE: lib/Google/vendor/brick/math/src/Internal/Calculator.php
================================================
init($a, $b);
if ($aNeg && ! $bNeg) {
return -1;
}
if ($bNeg && ! $aNeg) {
return 1;
}
$aLen = \strlen($aDig);
$bLen = \strlen($bDig);
if ($aLen < $bLen) {
$result = -1;
} elseif ($aLen > $bLen) {
$result = 1;
} else {
$result = $aDig <=> $bDig;
}
return $aNeg ? -$result : $result;
}
/**
* Adds two numbers.
*/
abstract public function add(string $a, string $b) : string;
/**
* Subtracts two numbers.
*/
abstract public function sub(string $a, string $b) : string;
/**
* Multiplies two numbers.
*/
abstract public function mul(string $a, string $b) : string;
/**
* Returns the quotient of the division of two numbers.
*
* @param string $a The dividend.
* @param string $b The divisor, must not be zero.
*
* @return string The quotient.
*/
abstract public function divQ(string $a, string $b) : string;
/**
* Returns the remainder of the division of two numbers.
*
* @param string $a The dividend.
* @param string $b The divisor, must not be zero.
*
* @return string The remainder.
*/
abstract public function divR(string $a, string $b) : string;
/**
* Returns the quotient and remainder of the division of two numbers.
*
* @param string $a The dividend.
* @param string $b The divisor, must not be zero.
*
* @return array{string, string} An array containing the quotient and remainder.
*/
abstract public function divQR(string $a, string $b) : array;
/**
* Exponentiates a number.
*
* @param string $a The base number.
* @param int $e The exponent, validated as an integer between 0 and MAX_POWER.
*
* @return string The power.
*/
abstract public function pow(string $a, int $e) : string;
/**
* @param string $b The modulus; must not be zero.
*/
public function mod(string $a, string $b) : string
{
return $this->divR($this->add($this->divR($a, $b), $b), $b);
}
/**
* Returns the modular multiplicative inverse of $x modulo $m.
*
* If $x has no multiplicative inverse mod m, this method must return null.
*
* This method can be overridden by the concrete implementation if the underlying library has built-in support.
*
* @param string $m The modulus; must not be negative or zero.
*/
public function modInverse(string $x, string $m) : ?string
{
if ($m === '1') {
return '0';
}
$modVal = $x;
if ($x[0] === '-' || ($this->cmp($this->abs($x), $m) >= 0)) {
$modVal = $this->mod($x, $m);
}
[$g, $x] = $this->gcdExtended($modVal, $m);
if ($g !== '1') {
return null;
}
return $this->mod($this->add($this->mod($x, $m), $m), $m);
}
/**
* Raises a number into power with modulo.
*
* @param string $base The base number; must be positive or zero.
* @param string $exp The exponent; must be positive or zero.
* @param string $mod The modulus; must be strictly positive.
*/
abstract public function modPow(string $base, string $exp, string $mod) : string;
/**
* Returns the greatest common divisor of the two numbers.
*
* This method can be overridden by the concrete implementation if the underlying library
* has built-in support for GCD calculations.
*
* @return string The GCD, always positive, or zero if both arguments are zero.
*/
public function gcd(string $a, string $b) : string
{
if ($a === '0') {
return $this->abs($b);
}
if ($b === '0') {
return $this->abs($a);
}
return $this->gcd($b, $this->divR($a, $b));
}
/**
* @return array{string, string, string} GCD, X, Y
*/
private function gcdExtended(string $a, string $b) : array
{
if ($a === '0') {
return [$b, '0', '1'];
}
[$gcd, $x1, $y1] = $this->gcdExtended($this->mod($b, $a), $a);
$x = $this->sub($y1, $this->mul($this->divQ($b, $a), $x1));
$y = $x1;
return [$gcd, $x, $y];
}
/**
* Returns the square root of the given number, rounded down.
*
* The result is the largest x such that x² ≤ n.
* The input MUST NOT be negative.
*/
abstract public function sqrt(string $n) : string;
/**
* Converts a number from an arbitrary base.
*
* This method can be overridden by the concrete implementation if the underlying library
* has built-in support for base conversion.
*
* @param string $number The number, positive or zero, non-empty, case-insensitively validated for the given base.
* @param int $base The base of the number, validated from 2 to 36.
*
* @return string The converted number, following the Calculator conventions.
*/
public function fromBase(string $number, int $base) : string
{
return $this->fromArbitraryBase(\strtolower($number), self::ALPHABET, $base);
}
/**
* Converts a number to an arbitrary base.
*
* This method can be overridden by the concrete implementation if the underlying library
* has built-in support for base conversion.
*
* @param string $number The number to convert, following the Calculator conventions.
* @param int $base The base to convert to, validated from 2 to 36.
*
* @return string The converted number, lowercase.
*/
public function toBase(string $number, int $base) : string
{
$negative = ($number[0] === '-');
if ($negative) {
$number = \substr($number, 1);
}
$number = $this->toArbitraryBase($number, self::ALPHABET, $base);
if ($negative) {
return '-' . $number;
}
return $number;
}
/**
* Converts a non-negative number in an arbitrary base using a custom alphabet, to base 10.
*
* @param string $number The number to convert, validated as a non-empty string,
* containing only chars in the given alphabet/base.
* @param string $alphabet The alphabet that contains every digit, validated as 2 chars minimum.
* @param int $base The base of the number, validated from 2 to alphabet length.
*
* @return string The number in base 10, following the Calculator conventions.
*/
final public function fromArbitraryBase(string $number, string $alphabet, int $base) : string
{
// remove leading "zeros"
$number = \ltrim($number, $alphabet[0]);
if ($number === '') {
return '0';
}
// optimize for "one"
if ($number === $alphabet[1]) {
return '1';
}
$result = '0';
$power = '1';
$base = (string) $base;
for ($i = \strlen($number) - 1; $i >= 0; $i--) {
$index = \strpos($alphabet, $number[$i]);
if ($index !== 0) {
$result = $this->add($result, ($index === 1)
? $power
: $this->mul($power, (string) $index)
);
}
if ($i !== 0) {
$power = $this->mul($power, $base);
}
}
return $result;
}
/**
* Converts a non-negative number to an arbitrary base using a custom alphabet.
*
* @param string $number The number to convert, positive or zero, following the Calculator conventions.
* @param string $alphabet The alphabet that contains every digit, validated as 2 chars minimum.
* @param int $base The base to convert to, validated from 2 to alphabet length.
*
* @return string The converted number in the given alphabet.
*/
final public function toArbitraryBase(string $number, string $alphabet, int $base) : string
{
if ($number === '0') {
return $alphabet[0];
}
$base = (string) $base;
$result = '';
while ($number !== '0') {
[$number, $remainder] = $this->divQR($number, $base);
$remainder = (int) $remainder;
$result .= $alphabet[$remainder];
}
return \strrev($result);
}
/**
* Performs a rounded division.
*
* Rounding is performed when the remainder of the division is not zero.
*
* @param string $a The dividend.
* @param string $b The divisor, must not be zero.
* @param RoundingMode $roundingMode The rounding mode.
*
* @throws \InvalidArgumentException If the rounding mode is invalid.
* @throws RoundingNecessaryException If RoundingMode::UNNECESSARY is provided but rounding is necessary.
*
* @psalm-suppress ImpureFunctionCall
*/
final public function divRound(string $a, string $b, RoundingMode $roundingMode) : string
{
[$quotient, $remainder] = $this->divQR($a, $b);
$hasDiscardedFraction = ($remainder !== '0');
$isPositiveOrZero = ($a[0] === '-') === ($b[0] === '-');
$discardedFractionSign = function() use ($remainder, $b) : int {
$r = $this->abs($this->mul($remainder, '2'));
$b = $this->abs($b);
return $this->cmp($r, $b);
};
$increment = false;
switch ($roundingMode) {
case RoundingMode::UNNECESSARY:
if ($hasDiscardedFraction) {
throw RoundingNecessaryException::roundingNecessary();
}
break;
case RoundingMode::UP:
$increment = $hasDiscardedFraction;
break;
case RoundingMode::DOWN:
break;
case RoundingMode::CEILING:
$increment = $hasDiscardedFraction && $isPositiveOrZero;
break;
case RoundingMode::FLOOR:
$increment = $hasDiscardedFraction && ! $isPositiveOrZero;
break;
case RoundingMode::HALF_UP:
$increment = $discardedFractionSign() >= 0;
break;
case RoundingMode::HALF_DOWN:
$increment = $discardedFractionSign() > 0;
break;
case RoundingMode::HALF_CEILING:
$increment = $isPositiveOrZero ? $discardedFractionSign() >= 0 : $discardedFractionSign() > 0;
break;
case RoundingMode::HALF_FLOOR:
$increment = $isPositiveOrZero ? $discardedFractionSign() > 0 : $discardedFractionSign() >= 0;
break;
case RoundingMode::HALF_EVEN:
$lastDigit = (int) $quotient[-1];
$lastDigitIsEven = ($lastDigit % 2 === 0);
$increment = $lastDigitIsEven ? $discardedFractionSign() > 0 : $discardedFractionSign() >= 0;
break;
default:
throw new \InvalidArgumentException('Invalid rounding mode.');
}
if ($increment) {
return $this->add($quotient, $isPositiveOrZero ? '1' : '-1');
}
return $quotient;
}
/**
* Calculates bitwise AND of two numbers.
*
* This method can be overridden by the concrete implementation if the underlying library
* has built-in support for bitwise operations.
*/
public function and(string $a, string $b) : string
{
return $this->bitwise('and', $a, $b);
}
/**
* Calculates bitwise OR of two numbers.
*
* This method can be overridden by the concrete implementation if the underlying library
* has built-in support for bitwise operations.
*/
public function or(string $a, string $b) : string
{
return $this->bitwise('or', $a, $b);
}
/**
* Calculates bitwise XOR of two numbers.
*
* This method can be overridden by the concrete implementation if the underlying library
* has built-in support for bitwise operations.
*/
public function xor(string $a, string $b) : string
{
return $this->bitwise('xor', $a, $b);
}
/**
* Performs a bitwise operation on a decimal number.
*
* @param 'and'|'or'|'xor' $operator The operator to use.
* @param string $a The left operand.
* @param string $b The right operand.
*/
private function bitwise(string $operator, string $a, string $b) : string
{
[$aNeg, $bNeg, $aDig, $bDig] = $this->init($a, $b);
$aBin = $this->toBinary($aDig);
$bBin = $this->toBinary($bDig);
$aLen = \strlen($aBin);
$bLen = \strlen($bBin);
if ($aLen > $bLen) {
$bBin = \str_repeat("\x00", $aLen - $bLen) . $bBin;
} elseif ($bLen > $aLen) {
$aBin = \str_repeat("\x00", $bLen - $aLen) . $aBin;
}
if ($aNeg) {
$aBin = $this->twosComplement($aBin);
}
if ($bNeg) {
$bBin = $this->twosComplement($bBin);
}
$value = match ($operator) {
'and' => $aBin & $bBin,
'or' => $aBin | $bBin,
'xor' => $aBin ^ $bBin,
};
$negative = match ($operator) {
'and' => $aNeg and $bNeg,
'or' => $aNeg or $bNeg,
'xor' => $aNeg xor $bNeg,
};
if ($negative) {
$value = $this->twosComplement($value);
}
$result = $this->toDecimal($value);
return $negative ? $this->neg($result) : $result;
}
/**
* @param string $number A positive, binary number.
*/
private function twosComplement(string $number) : string
{
$xor = \str_repeat("\xff", \strlen($number));
$number ^= $xor;
for ($i = \strlen($number) - 1; $i >= 0; $i--) {
$byte = \ord($number[$i]);
if (++$byte !== 256) {
$number[$i] = \chr($byte);
break;
}
$number[$i] = "\x00";
if ($i === 0) {
$number = "\x01" . $number;
}
}
return $number;
}
/**
* Converts a decimal number to a binary string.
*
* @param string $number The number to convert, positive or zero, only digits.
*/
private function toBinary(string $number) : string
{
$result = '';
while ($number !== '0') {
[$number, $remainder] = $this->divQR($number, '256');
$result .= \chr((int) $remainder);
}
return \strrev($result);
}
/**
* Returns the positive decimal representation of a binary number.
*
* @param string $bytes The bytes representing the number.
*/
private function toDecimal(string $bytes) : string
{
$result = '0';
$power = '1';
for ($i = \strlen($bytes) - 1; $i >= 0; $i--) {
$index = \ord($bytes[$i]);
if ($index !== 0) {
$result = $this->add($result, ($index === 1)
? $power
: $this->mul($power, (string) $index)
);
}
if ($i !== 0) {
$power = $this->mul($power, '256');
}
}
return $result;
}
}
================================================
FILE: lib/Google/vendor/brick/math/src/RoundingMode.php
================================================
= 0.5; otherwise, behaves as for DOWN.
* Note that this is the rounding mode commonly taught at school.
*/
case HALF_UP;
/**
* Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.
*
* Behaves as for UP if the discarded fraction is > 0.5; otherwise, behaves as for DOWN.
*/
case HALF_DOWN;
/**
* Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards positive infinity.
*
* If the result is positive, behaves as for HALF_UP; if negative, behaves as for HALF_DOWN.
*/
case HALF_CEILING;
/**
* Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards negative infinity.
*
* If the result is positive, behaves as for HALF_DOWN; if negative, behaves as for HALF_UP.
*/
case HALF_FLOOR;
/**
* Rounds towards the "nearest neighbor" unless both neighbors are equidistant, in which case rounds towards the even neighbor.
*
* Behaves as for HALF_UP if the digit to the left of the discarded fraction is odd;
* behaves as for HALF_DOWN if it's even.
*
* Note that this is the rounding mode that statistically minimizes
* cumulative error when applied repeatedly over a sequence of calculations.
* It is sometimes known as "Banker's rounding", and is chiefly used in the USA.
*/
case HALF_EVEN;
}
================================================
FILE: lib/Google/vendor/composer/ClassLoader.php
================================================
* Jordi Boggiano
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier
* @author Jordi Boggiano
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir;
// PSR-4
/**
* @var array>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array>
*/
private $prefixDirsPsr4 = array();
/**
* @var list
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array>>
*/
private $prefixesPsr0 = array();
/**
* @var list
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var array
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var array
*/
private $missingClasses = array();
/** @var string|null */
private $apcuPrefix;
/**
* @var array
*/
private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return array>
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
/**
* @return array>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return list
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return list
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return array Array of classname => path
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*
* @return void
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param list|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
$paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param list|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
/**
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return array
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}
================================================
FILE: lib/Google/vendor/composer/InstalledVersions.php
================================================
* Jordi Boggiano
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
/**
* @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
* @internal
*/
private static $selfDir = null;
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null
*/
private static $installed;
/**
* @var bool
*/
private static $installedIsLocalDir;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
// so we have to assume it does not, and that may result in duplicate data being returned when listing
// all installed packages for example
self::$installedIsLocalDir = false;
}
/**
* @return string
*/
private static function getSelfDir()
{
if (self::$selfDir === null) {
self::$selfDir = strtr(__DIR__, '\\', '/');
}
return self::$selfDir;
}
/**
* @return array[]
* @psalm-return list}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
$copiedLocalDir = false;
if (self::$canGetVendors) {
$selfDir = self::getSelfDir();
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
$vendorDir = strtr($vendorDir, '\\', '/');
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */
$required = require $vendorDir.'/composer/installed.php';
self::$installedByVendor[$vendorDir] = $required;
$installed[] = $required;
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
self::$installed = $required;
self::$installedIsLocalDir = true;
}
}
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
$copiedLocalDir = true;
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}
return $installed;
}
}
================================================
FILE: lib/Google/vendor/composer/LICENSE
================================================
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: lib/Google/vendor/composer/autoload_classmap.php
================================================
$vendorDir . '/composer/InstalledVersions.php',
'GPBMetadata\\GrpcGcp' => $vendorDir . '/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php',
'Google_AccessToken_Revoke' => $baseDir . '/src/aliases.php',
'Google_AccessToken_Verify' => $baseDir . '/src/aliases.php',
'Google_AuthHandler_AuthHandlerFactory' => $baseDir . '/src/aliases.php',
'Google_AuthHandler_Guzzle6AuthHandler' => $baseDir . '/src/aliases.php',
'Google_AuthHandler_Guzzle7AuthHandler' => $baseDir . '/src/aliases.php',
'Google_Client' => $baseDir . '/src/aliases.php',
'Google_Collection' => $baseDir . '/src/aliases.php',
'Google_Exception' => $baseDir . '/src/aliases.php',
'Google_Http_Batch' => $baseDir . '/src/aliases.php',
'Google_Http_MediaFileUpload' => $baseDir . '/src/aliases.php',
'Google_Http_REST' => $baseDir . '/src/aliases.php',
'Google_Model' => $baseDir . '/src/aliases.php',
'Google_Service' => $baseDir . '/src/aliases.php',
'Google_Service_Exception' => $baseDir . '/src/aliases.php',
'Google_Service_Resource' => $baseDir . '/src/aliases.php',
'Google_Task_Composer' => $baseDir . '/src/aliases.php',
'Google_Task_Exception' => $baseDir . '/src/aliases.php',
'Google_Task_Retryable' => $baseDir . '/src/aliases.php',
'Google_Task_Runner' => $baseDir . '/src/aliases.php',
'Google_Utils_UriTemplate' => $baseDir . '/src/aliases.php',
'Grpc\\Gcp\\AffinityConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig.php',
'Grpc\\Gcp\\AffinityConfig_Command' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig_Command.php',
'Grpc\\Gcp\\ApiConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php',
'Grpc\\Gcp\\ChannelPoolConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php',
'Grpc\\Gcp\\MethodConfig' => $vendorDir . '/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php',
);
================================================
FILE: lib/Google/vendor/composer/autoload_files.php
================================================
$vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'e39a8b23c42d4e1452234d762b03835a' => $vendorDir . '/ramsey/uuid/src/functions.php',
'1f87db08236948d07391152dccb70f04' => $vendorDir . '/google/apiclient-services/autoload.php',
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'a8d3953fd9959404dd22d3dfcd0a79f0' => $baseDir . '/src/aliases.php',
);
================================================
FILE: lib/Google/vendor/composer/autoload_namespaces.php
================================================
array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
'Rize\\' => array($vendorDir . '/rize/uri-template/src/Rize'),
'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'),
'Ramsey\\Collection\\' => array($vendorDir . '/ramsey/collection/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'),
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Grpc\\Gcp\\' => array($vendorDir . '/google/grpc-gcp/src'),
'Grpc\\' => array($vendorDir . '/grpc/grpc/src/lib'),
'Google\\Type\\' => array($vendorDir . '/google/common-protos/src/Type'),
'Google\\Service\\' => array($vendorDir . '/google/apiclient-services/src'),
'Google\\Rpc\\' => array($vendorDir . '/google/common-protos/src/Rpc'),
'Google\\Protobuf\\' => array($vendorDir . '/google/protobuf/src/Google/Protobuf'),
'Google\\LongRunning\\' => array($vendorDir . '/google/longrunning/src/LongRunning'),
'Google\\Iam\\' => array($vendorDir . '/google/common-protos/src/Iam'),
'Google\\Cloud\\Storage\\' => array($vendorDir . '/google/cloud-storage/src'),
'Google\\Cloud\\Core\\' => array($vendorDir . '/google/cloud-core/src'),
'Google\\Cloud\\' => array($vendorDir . '/google/common-protos/src/Cloud'),
'Google\\Auth\\' => array($vendorDir . '/google/auth/src'),
'Google\\Api\\' => array($vendorDir . '/google/common-protos/src/Api'),
'Google\\ApiCore\\LongRunning\\' => array($vendorDir . '/google/longrunning/src/ApiCore/LongRunning'),
'Google\\ApiCore\\' => array($vendorDir . '/google/gax/src'),
'Google\\' => array($baseDir . '/src'),
'GPBMetadata\\Google\\Type\\' => array($vendorDir . '/google/common-protos/metadata/Type'),
'GPBMetadata\\Google\\Rpc\\' => array($vendorDir . '/google/common-protos/metadata/Rpc'),
'GPBMetadata\\Google\\Protobuf\\' => array($vendorDir . '/google/protobuf/src/GPBMetadata/Google/Protobuf'),
'GPBMetadata\\Google\\Longrunning\\' => array($vendorDir . '/google/longrunning/metadata/Longrunning'),
'GPBMetadata\\Google\\Logging\\' => array($vendorDir . '/google/common-protos/metadata/Logging'),
'GPBMetadata\\Google\\Iam\\' => array($vendorDir . '/google/common-protos/metadata/Iam'),
'GPBMetadata\\Google\\Cloud\\' => array($vendorDir . '/google/common-protos/metadata/Cloud'),
'GPBMetadata\\Google\\Api\\' => array($vendorDir . '/google/common-protos/metadata/Api'),
'GPBMetadata\\ApiCore\\' => array($vendorDir . '/google/gax/metadata/ApiCore'),
'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'),
'Brick\\Math\\' => array($vendorDir . '/brick/math/src'),
);
================================================
FILE: lib/Google/vendor/composer/autoload_real.php
================================================
register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitc1ba3d113640ecbb1bd5645a9bacb037::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
}
return $loader;
}
}
================================================
FILE: lib/Google/vendor/composer/autoload_static.php
================================================
__DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php',
'1f87db08236948d07391152dccb70f04' => __DIR__ . '/..' . '/google/apiclient-services/autoload.php',
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'a8d3953fd9959404dd22d3dfcd0a79f0' => __DIR__ . '/../..' . '/src/aliases.php',
);
public static $prefixLengthsPsr4 = array (
'p' =>
array (
'phpseclib3\\' => 11,
),
'R' =>
array (
'Rize\\' => 5,
'Ramsey\\Uuid\\' => 12,
'Ramsey\\Collection\\' => 18,
),
'P' =>
array (
'Psr\\Log\\' => 8,
'Psr\\Http\\Message\\' => 17,
'Psr\\Http\\Client\\' => 16,
'Psr\\Cache\\' => 10,
'ParagonIE\\ConstantTime\\' => 23,
),
'M' =>
array (
'Monolog\\' => 8,
),
'G' =>
array (
'GuzzleHttp\\Psr7\\' => 16,
'GuzzleHttp\\Promise\\' => 19,
'GuzzleHttp\\' => 11,
'Grpc\\Gcp\\' => 9,
'Grpc\\' => 5,
'Google\\Type\\' => 12,
'Google\\Service\\' => 15,
'Google\\Rpc\\' => 11,
'Google\\Protobuf\\' => 16,
'Google\\LongRunning\\' => 19,
'Google\\Iam\\' => 11,
'Google\\Cloud\\Storage\\' => 21,
'Google\\Cloud\\Core\\' => 18,
'Google\\Cloud\\' => 13,
'Google\\Auth\\' => 12,
'Google\\Api\\' => 11,
'Google\\ApiCore\\LongRunning\\' => 27,
'Google\\ApiCore\\' => 15,
'Google\\' => 7,
'GPBMetadata\\Google\\Type\\' => 24,
'GPBMetadata\\Google\\Rpc\\' => 23,
'GPBMetadata\\Google\\Protobuf\\' => 28,
'GPBMetadata\\Google\\Longrunning\\' => 31,
'GPBMetadata\\Google\\Logging\\' => 27,
'GPBMetadata\\Google\\Iam\\' => 23,
'GPBMetadata\\Google\\Cloud\\' => 25,
'GPBMetadata\\Google\\Api\\' => 23,
'GPBMetadata\\ApiCore\\' => 20,
),
'F' =>
array (
'Firebase\\JWT\\' => 13,
),
'B' =>
array (
'Brick\\Math\\' => 11,
),
);
public static $prefixDirsPsr4 = array (
'phpseclib3\\' =>
array (
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
),
'Rize\\' =>
array (
0 => __DIR__ . '/..' . '/rize/uri-template/src/Rize',
),
'Ramsey\\Uuid\\' =>
array (
0 => __DIR__ . '/..' . '/ramsey/uuid/src',
),
'Ramsey\\Collection\\' =>
array (
0 => __DIR__ . '/..' . '/ramsey/collection/src',
),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/src',
),
'Psr\\Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-factory/src',
1 => __DIR__ . '/..' . '/psr/http-message/src',
),
'Psr\\Http\\Client\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-client/src',
),
'Psr\\Cache\\' =>
array (
0 => __DIR__ . '/..' . '/psr/cache/src',
),
'ParagonIE\\ConstantTime\\' =>
array (
0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src',
),
'Monolog\\' =>
array (
0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',
),
'GuzzleHttp\\Psr7\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
),
'GuzzleHttp\\Promise\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/promises/src',
),
'GuzzleHttp\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
),
'Grpc\\Gcp\\' =>
array (
0 => __DIR__ . '/..' . '/google/grpc-gcp/src',
),
'Grpc\\' =>
array (
0 => __DIR__ . '/..' . '/grpc/grpc/src/lib',
),
'Google\\Type\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/src/Type',
),
'Google\\Service\\' =>
array (
0 => __DIR__ . '/..' . '/google/apiclient-services/src',
),
'Google\\Rpc\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/src/Rpc',
),
'Google\\Protobuf\\' =>
array (
0 => __DIR__ . '/..' . '/google/protobuf/src/Google/Protobuf',
),
'Google\\LongRunning\\' =>
array (
0 => __DIR__ . '/..' . '/google/longrunning/src/LongRunning',
),
'Google\\Iam\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/src/Iam',
),
'Google\\Cloud\\Storage\\' =>
array (
0 => __DIR__ . '/..' . '/google/cloud-storage/src',
),
'Google\\Cloud\\Core\\' =>
array (
0 => __DIR__ . '/..' . '/google/cloud-core/src',
),
'Google\\Cloud\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/src/Cloud',
),
'Google\\Auth\\' =>
array (
0 => __DIR__ . '/..' . '/google/auth/src',
),
'Google\\Api\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/src/Api',
),
'Google\\ApiCore\\LongRunning\\' =>
array (
0 => __DIR__ . '/..' . '/google/longrunning/src/ApiCore/LongRunning',
),
'Google\\ApiCore\\' =>
array (
0 => __DIR__ . '/..' . '/google/gax/src',
),
'Google\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
'GPBMetadata\\Google\\Type\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/metadata/Type',
),
'GPBMetadata\\Google\\Rpc\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/metadata/Rpc',
),
'GPBMetadata\\Google\\Protobuf\\' =>
array (
0 => __DIR__ . '/..' . '/google/protobuf/src/GPBMetadata/Google/Protobuf',
),
'GPBMetadata\\Google\\Longrunning\\' =>
array (
0 => __DIR__ . '/..' . '/google/longrunning/metadata/Longrunning',
),
'GPBMetadata\\Google\\Logging\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/metadata/Logging',
),
'GPBMetadata\\Google\\Iam\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/metadata/Iam',
),
'GPBMetadata\\Google\\Cloud\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/metadata/Cloud',
),
'GPBMetadata\\Google\\Api\\' =>
array (
0 => __DIR__ . '/..' . '/google/common-protos/metadata/Api',
),
'GPBMetadata\\ApiCore\\' =>
array (
0 => __DIR__ . '/..' . '/google/gax/metadata/ApiCore',
),
'Firebase\\JWT\\' =>
array (
0 => __DIR__ . '/..' . '/firebase/php-jwt/src',
),
'Brick\\Math\\' =>
array (
0 => __DIR__ . '/..' . '/brick/math/src',
),
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'GPBMetadata\\GrpcGcp' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/GPBMetadata/GrpcGcp.php',
'Google_AccessToken_Revoke' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_AccessToken_Verify' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_AuthHandler_AuthHandlerFactory' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_AuthHandler_Guzzle6AuthHandler' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_AuthHandler_Guzzle7AuthHandler' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Client' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Collection' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Exception' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Http_Batch' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Http_MediaFileUpload' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Http_REST' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Model' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Service' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Service_Exception' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Service_Resource' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Task_Composer' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Task_Exception' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Task_Retryable' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Task_Runner' => __DIR__ . '/../..' . '/src/aliases.php',
'Google_Utils_UriTemplate' => __DIR__ . '/../..' . '/src/aliases.php',
'Grpc\\Gcp\\AffinityConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig.php',
'Grpc\\Gcp\\AffinityConfig_Command' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/AffinityConfig_Command.php',
'Grpc\\Gcp\\ApiConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/ApiConfig.php',
'Grpc\\Gcp\\ChannelPoolConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/ChannelPoolConfig.php',
'Grpc\\Gcp\\MethodConfig' => __DIR__ . '/..' . '/google/grpc-gcp/src/generated/Grpc/Gcp/MethodConfig.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitc1ba3d113640ecbb1bd5645a9bacb037::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitc1ba3d113640ecbb1bd5645a9bacb037::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitc1ba3d113640ecbb1bd5645a9bacb037::$classMap;
}, null, ClassLoader::class);
}
}
================================================
FILE: lib/Google/vendor/composer/installed.json
================================================
{
"packages": [
{
"name": "brick/math",
"version": "0.13.1",
"version_normalized": "0.13.1.0",
"source": {
"type": "git",
"url": "https://github.com/brick/math.git",
"reference": "fc7ed316430118cc7836bf45faff18d5dfc8de04"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/brick/math/zipball/fc7ed316430118cc7836bf45faff18d5dfc8de04",
"reference": "fc7ed316430118cc7836bf45faff18d5dfc8de04",
"shasum": ""
},
"require": {
"php": "^8.1"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.2",
"phpunit/phpunit": "^10.1",
"vimeo/psalm": "6.8.8"
},
"time": "2025-03-29T13:50:30+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Brick\\Math\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Arbitrary-precision arithmetic library",
"keywords": [
"Arbitrary-precision",
"BigInteger",
"BigRational",
"arithmetic",
"bigdecimal",
"bignum",
"bignumber",
"brick",
"decimal",
"integer",
"math",
"mathematics",
"rational"
],
"support": {
"issues": "https://github.com/brick/math/issues",
"source": "https://github.com/brick/math/tree/0.13.1"
},
"funding": [
{
"url": "https://github.com/BenMorel",
"type": "github"
}
],
"install-path": "../brick/math"
},
{
"name": "firebase/php-jwt",
"version": "v7.0.2",
"version_normalized": "7.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "5645b43af647b6947daac1d0f659dd1fbe8d3b65"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/5645b43af647b6947daac1d0f659dd1fbe8d3b65",
"reference": "5645b43af647b6947daac1d0f659dd1fbe8d3b65",
"shasum": ""
},
"require": {
"php": "^8.0"
},
"require-dev": {
"guzzlehttp/guzzle": "^7.4",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5",
"psr/cache": "^2.0||^3.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0"
},
"suggest": {
"ext-sodium": "Support EdDSA (Ed25519) signatures",
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
},
"time": "2025-12-16T22:17:28+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Firebase\\JWT\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Neuman Vong",
"email": "neuman+pear@twilio.com",
"role": "Developer"
},
{
"name": "Anant Narayanan",
"email": "anant@php.net",
"role": "Developer"
}
],
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
"homepage": "https://github.com/firebase/php-jwt",
"keywords": [
"jwt",
"php"
],
"support": {
"issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v7.0.2"
},
"install-path": "../firebase/php-jwt"
},
{
"name": "google/apiclient-services",
"version": "v0.427.0",
"version_normalized": "0.427.0.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-api-php-client-services.git",
"reference": "cc74cd104a1ed1cf545480c52f13831e6eb0efe2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/cc74cd104a1ed1cf545480c52f13831e6eb0efe2",
"reference": "cc74cd104a1ed1cf545480c52f13831e6eb0efe2",
"shasum": ""
},
"require": {
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^9.6"
},
"time": "2025-12-24T01:04:22+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"autoload.php"
],
"psr-4": {
"Google\\Service\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "Client library for Google APIs",
"homepage": "http://developers.google.com/api-client-library/php",
"keywords": [
"google"
],
"support": {
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.427.0"
},
"install-path": "../google/apiclient-services"
},
{
"name": "google/auth",
"version": "v1.50.0",
"version_normalized": "1.50.0.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-auth-library-php.git",
"reference": "e1c26a718198e16d8a3c69b1cae136b73f959b0f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/e1c26a718198e16d8a3c69b1cae136b73f959b0f",
"reference": "e1c26a718198e16d8a3c69b1cae136b73f959b0f",
"shasum": ""
},
"require": {
"firebase/php-jwt": "^6.0||^7.0",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.4.5",
"php": "^8.1",
"psr/cache": "^2.0||^3.0",
"psr/http-message": "^1.1||^2.0",
"psr/log": "^3.0"
},
"require-dev": {
"guzzlehttp/promises": "^2.0",
"kelvinmo/simplejwt": "^1.1.0",
"phpseclib/phpseclib": "^3.0.35",
"phpspec/prophecy-phpunit": "^2.1",
"phpunit/phpunit": "^9.6",
"sebastian/comparator": ">=1.2.3",
"squizlabs/php_codesniffer": "^4.0",
"symfony/filesystem": "^6.3||^7.3",
"symfony/process": "^6.0||^7.0",
"webmozart/assert": "^1.11||^2.0"
},
"suggest": {
"phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2."
},
"time": "2026-01-08T21:33:57+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Google\\Auth\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "Google Auth Library for PHP",
"homepage": "https://github.com/google/google-auth-library-php",
"keywords": [
"Authentication",
"google",
"oauth2"
],
"support": {
"docs": "https://cloud.google.com/php/docs/reference/auth/latest",
"issues": "https://github.com/googleapis/google-auth-library-php/issues",
"source": "https://github.com/googleapis/google-auth-library-php/tree/v1.50.0"
},
"install-path": "../google/auth"
},
{
"name": "google/cloud-core",
"version": "v1.69.0",
"version_normalized": "1.69.0.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-cloud-php-core.git",
"reference": "a35bcf9d79f7007eaaf325e00011d08f40494fb1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/a35bcf9d79f7007eaaf325e00011d08f40494fb1",
"reference": "a35bcf9d79f7007eaaf325e00011d08f40494fb1",
"shasum": ""
},
"require": {
"google/auth": "^1.34",
"google/gax": "^1.38.0",
"guzzlehttp/guzzle": "^6.5.8||^7.4.4",
"guzzlehttp/promises": "^1.4||^2.0",
"guzzlehttp/psr7": "^2.6",
"monolog/monolog": "^2.9||^3.0",
"php": "^8.1",
"psr/http-message": "^1.0||^2.0",
"rize/uri-template": "~0.3||~0.4"
},
"require-dev": {
"erusev/parsedown": "^1.6",
"google/cloud-common-protos": "~0.5",
"nikic/php-parser": "^5.6",
"opis/closure": "^3.7|^4.0",
"phpdocumentor/reflection": "^6.0",
"phpdocumentor/reflection-docblock": "^5.3",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.0",
"squizlabs/php_codesniffer": "2.*"
},
"suggest": {
"opis/closure": "May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.",
"symfony/lock": "Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9"
},
"time": "2025-12-06T04:51:04+00:00",
"bin": [
"bin/google-cloud-batch"
],
"type": "library",
"extra": {
"component": {
"id": "cloud-core",
"path": "Core",
"entry": "src/ServiceBuilder.php",
"target": "googleapis/google-cloud-php-core.git"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Google\\Cloud\\Core\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "Google Cloud PHP shared dependency, providing functionality useful to all components.",
"support": {
"source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.69.0"
},
"install-path": "../google/cloud-core"
},
{
"name": "google/cloud-storage",
"version": "v1.49.0",
"version_normalized": "1.49.0.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-cloud-php-storage.git",
"reference": "30aefa19ce5af165cef8bb39c224cfa865461541"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/30aefa19ce5af165cef8bb39c224cfa865461541",
"reference": "30aefa19ce5af165cef8bb39c224cfa865461541",
"shasum": ""
},
"require": {
"google/cloud-core": "^1.57",
"php": "^8.1",
"ramsey/uuid": "^4.2.3"
},
"require-dev": {
"erusev/parsedown": "^1.6",
"google/cloud-pubsub": "^2.0",
"phpdocumentor/reflection": "^5.3.3||^6.0",
"phpdocumentor/reflection-docblock": "^5.3",
"phpseclib/phpseclib": "^2.0||^3.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.0",
"squizlabs/php_codesniffer": "2.*"
},
"suggest": {
"google/cloud-pubsub": "May be used to register a topic to receive bucket notifications.",
"phpseclib/phpseclib": "May be used in place of OpenSSL for creating signed Cloud Storage URLs. Please require version ^2."
},
"time": "2025-12-06T04:51:04+00:00",
"type": "library",
"extra": {
"component": {
"id": "cloud-storage",
"path": "Storage",
"entry": "src/StorageClient.php",
"target": "googleapis/google-cloud-php-storage.git"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Google\\Cloud\\Storage\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "Cloud Storage Client for PHP",
"support": {
"source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.49.0"
},
"install-path": "../google/cloud-storage"
},
{
"name": "google/common-protos",
"version": "4.12.4",
"version_normalized": "4.12.4.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/common-protos-php.git",
"reference": "0127156899af0df2681bd42024c60bd5360d64e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/0127156899af0df2681bd42024c60bd5360d64e3",
"reference": "0127156899af0df2681bd42024c60bd5360d64e3",
"shasum": ""
},
"require": {
"google/protobuf": "^4.31",
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^9.6"
},
"time": "2025-09-20T01:29:44+00:00",
"type": "library",
"extra": {
"component": {
"id": "common-protos",
"path": "CommonProtos",
"entry": "README.md",
"target": "googleapis/common-protos-php.git"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Google\\Api\\": "src/Api",
"Google\\Iam\\": "src/Iam",
"Google\\Rpc\\": "src/Rpc",
"Google\\Type\\": "src/Type",
"Google\\Cloud\\": "src/Cloud",
"GPBMetadata\\Google\\Api\\": "metadata/Api",
"GPBMetadata\\Google\\Iam\\": "metadata/Iam",
"GPBMetadata\\Google\\Rpc\\": "metadata/Rpc",
"GPBMetadata\\Google\\Type\\": "metadata/Type",
"GPBMetadata\\Google\\Cloud\\": "metadata/Cloud",
"GPBMetadata\\Google\\Logging\\": "metadata/Logging"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "Google API Common Protos for PHP",
"homepage": "https://github.com/googleapis/common-protos-php",
"keywords": [
"google"
],
"support": {
"source": "https://github.com/googleapis/common-protos-php/tree/v4.12.4"
},
"install-path": "../google/common-protos"
},
{
"name": "google/gax",
"version": "v1.40.0",
"version_normalized": "1.40.0.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/gax-php.git",
"reference": "1d3834d60b3f0794427c64d2b27d7c627fbba92c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/gax-php/zipball/1d3834d60b3f0794427c64d2b27d7c627fbba92c",
"reference": "1d3834d60b3f0794427c64d2b27d7c627fbba92c",
"shasum": ""
},
"require": {
"google/auth": "^1.49",
"google/common-protos": "^4.4",
"google/grpc-gcp": "^0.4",
"google/longrunning": "~0.4",
"google/protobuf": "^4.31",
"grpc/grpc": "^1.13",
"guzzlehttp/promises": "^2.0",
"guzzlehttp/psr7": "^2.0",
"php": "^8.1",
"ramsey/uuid": "^4.0"
},
"conflict": {
"ext-protobuf": "<4.31.0"
},
"require-dev": {
"phpspec/prophecy-phpunit": "^2.1",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^9.6",
"squizlabs/php_codesniffer": "4.*"
},
"time": "2025-12-04T18:45:15+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Google\\ApiCore\\": "src",
"GPBMetadata\\ApiCore\\": "metadata/ApiCore"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Google API Core for PHP",
"homepage": "https://github.com/googleapis/gax-php",
"keywords": [
"google"
],
"support": {
"issues": "https://github.com/googleapis/gax-php/issues",
"source": "https://github.com/googleapis/gax-php/tree/v1.40.0"
},
"install-path": "../google/gax"
},
{
"name": "google/grpc-gcp",
"version": "v0.4.1",
"version_normalized": "0.4.1.0",
"source": {
"type": "git",
"url": "https://github.com/GoogleCloudPlatform/grpc-gcp-php.git",
"reference": "e585b7721bbe806ef45b5c52ae43dfc2bff89968"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GoogleCloudPlatform/grpc-gcp-php/zipball/e585b7721bbe806ef45b5c52ae43dfc2bff89968",
"reference": "e585b7721bbe806ef45b5c52ae43dfc2bff89968",
"shasum": ""
},
"require": {
"google/auth": "^1.3",
"google/protobuf": "^v3.25.3||^4.26.1",
"grpc/grpc": "^v1.13.0",
"php": "^8.0",
"psr/cache": "^1.0.1||^2.0.0||^3.0.0"
},
"require-dev": {
"google/cloud-spanner": "^1.7",
"phpunit/phpunit": "^9.0"
},
"time": "2025-02-19T21:53:22+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Grpc\\Gcp\\": "src/"
},
"classmap": [
"src/generated/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "gRPC GCP library for channel management",
"support": {
"issues": "https://github.com/GoogleCloudPlatform/grpc-gcp-php/issues",
"source": "https://github.com/GoogleCloudPlatform/grpc-gcp-php/tree/v0.4.1"
},
"install-path": "../google/grpc-gcp"
},
{
"name": "google/longrunning",
"version": "0.6.0",
"version_normalized": "0.6.0.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/php-longrunning.git",
"reference": "226d3b5166eaa13754cc5e452b37872478e23375"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/226d3b5166eaa13754cc5e452b37872478e23375",
"reference": "226d3b5166eaa13754cc5e452b37872478e23375",
"shasum": ""
},
"require-dev": {
"google/gax": "^1.38.0",
"phpunit/phpunit": "^9.0"
},
"time": "2025-10-07T18:41:09+00:00",
"type": "library",
"extra": {
"component": {
"id": "longrunning",
"path": "LongRunning",
"entry": null,
"target": "googleapis/php-longrunning"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Google\\LongRunning\\": "src/LongRunning",
"Google\\ApiCore\\LongRunning\\": "src/ApiCore/LongRunning",
"GPBMetadata\\Google\\Longrunning\\": "metadata/Longrunning"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "Google LongRunning Client for PHP",
"support": {
"source": "https://github.com/googleapis/php-longrunning/tree/v0.6.0"
},
"install-path": "../google/longrunning"
},
{
"name": "google/protobuf",
"version": "v4.33.2",
"version_normalized": "4.33.2.0",
"source": {
"type": "git",
"url": "https://github.com/protocolbuffers/protobuf-php.git",
"reference": "fbd96b7bf1343f4b0d8fb358526c7ba4d72f1318"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/fbd96b7bf1343f4b0d8fb358526c7ba4d72f1318",
"reference": "fbd96b7bf1343f4b0d8fb358526c7ba4d72f1318",
"shasum": ""
},
"require": {
"php": ">=8.1.0"
},
"require-dev": {
"phpunit/phpunit": ">=5.0.0 <8.5.27"
},
"suggest": {
"ext-bcmath": "Need to support JSON deserialization"
},
"time": "2025-12-05T22:12:22+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Google\\Protobuf\\": "src/Google/Protobuf",
"GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "proto library for PHP",
"homepage": "https://developers.google.com/protocol-buffers/",
"keywords": [
"proto"
],
"support": {
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.2"
},
"install-path": "../google/protobuf"
},
{
"name": "grpc/grpc",
"version": "1.74.0",
"version_normalized": "1.74.0.0",
"source": {
"type": "git",
"url": "https://github.com/grpc/grpc-php.git",
"reference": "32bf4dba256d60d395582fb6e4e8d3936bcdb713"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/grpc/grpc-php/zipball/32bf4dba256d60d395582fb6e4e8d3936bcdb713",
"reference": "32bf4dba256d60d395582fb6e4e8d3936bcdb713",
"shasum": ""
},
"require": {
"php": ">=7.0.0"
},
"require-dev": {
"google/auth": "^v1.3.0"
},
"suggest": {
"ext-protobuf": "For better performance, install the protobuf C extension.",
"google/protobuf": "To get started using grpc quickly, install the native protobuf library."
},
"time": "2025-07-24T20:02:16+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Grpc\\": "src/lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "gRPC library for PHP",
"homepage": "https://grpc.io",
"keywords": [
"rpc"
],
"support": {
"source": "https://github.com/grpc/grpc-php/tree/v1.74.0"
},
"install-path": "../grpc/grpc"
},
{
"name": "guzzlehttp/guzzle",
"version": "7.10.0",
"version_normalized": "7.10.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4",
"reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^2.3",
"guzzlehttp/psr7": "^2.8",
"php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0"
},
"provide": {
"psr/http-client-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"ext-curl": "*",
"guzzle/client-integration-tests": "3.0.2",
"php-http/message-factory": "^1.1",
"phpunit/phpunit": "^8.5.39 || ^9.6.20",
"psr/log": "^1.1 || ^2.0 || ^3.0"
},
"suggest": {
"ext-curl": "Required for CURL handler support",
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"time": "2025-08-23T22:36:01+00:00",
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"installation-source": "dist",
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Jeremy Lindblom",
"email": "jeremeamia@gmail.com",
"homepage": "https://github.com/jeremeamia"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle is a PHP HTTP client library",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"psr-18",
"psr-7",
"rest",
"web service"
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.10.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle",
"type": "tidelift"
}
],
"install-path": "../guzzlehttp/guzzle"
},
{
"name": "guzzlehttp/promises",
"version": "2.3.0",
"version_normalized": "2.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "481557b130ef3790cf82b713667b43030dc9c957"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957",
"reference": "481557b130ef3790cf82b713667b43030dc9c957",
"shasum": ""
},
"require": {
"php": "^7.2.5 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.44 || ^9.6.25"
},
"time": "2025-08-22T14:34:08+00:00",
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/2.3.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
"type": "tidelift"
}
],
"install-path": "../guzzlehttp/promises"
},
{
"name": "guzzlehttp/psr7",
"version": "2.8.0",
"version_normalized": "2.8.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "21dc724a0583619cd1652f673303492272778051"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051",
"reference": "21dc724a0583619cd1652f673303492272778051",
"shasum": ""
},
"require": {
"php": "^7.2.5 || ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.1 || ^2.0",
"ralouphie/getallheaders": "^3.0"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"http-interop/http-factory-tests": "0.9.0",
"phpunit/phpunit": "^8.5.44 || ^9.6.25"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"time": "2025-08-23T21:21:41+00:00",
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"psr-7",
"request",
"response",
"stream",
"uri",
"url"
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.8.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
"type": "tidelift"
}
],
"install-path": "../guzzlehttp/psr7"
},
{
"name": "monolog/monolog",
"version": "3.10.0",
"version_normalized": "3.10.0.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/b321dd6749f0bf7189444158a3ce785cc16d69b0",
"reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0",
"shasum": ""
},
"require": {
"php": ">=8.1",
"psr/log": "^2.0 || ^3.0"
},
"provide": {
"psr/log-implementation": "3.0.0"
},
"require-dev": {
"aws/aws-sdk-php": "^3.0",
"doctrine/couchdb": "~1.0@dev",
"elasticsearch/elasticsearch": "^7 || ^8",
"ext-json": "*",
"graylog2/gelf-php": "^1.4.2 || ^2.0",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.2",
"mongodb/mongodb": "^1.8 || ^2.0",
"php-amqplib/php-amqplib": "~2.4 || ^3",
"php-console/php-console": "^3.1.8",
"phpstan/phpstan": "^2",
"phpstan/phpstan-deprecation-rules": "^2",
"phpstan/phpstan-strict-rules": "^2",
"phpunit/phpunit": "^10.5.17 || ^11.0.7",
"predis/predis": "^1.1 || ^2",
"rollbar/rollbar": "^4.0",
"ruflin/elastica": "^7 || ^8",
"symfony/mailer": "^5.4 || ^6",
"symfony/mime": "^5.4 || ^6"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler",
"ext-mbstring": "Allow to work properly with unicode symbols",
"ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
"ext-openssl": "Required to send log messages using SSL",
"ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
},
"time": "2026-01-02T08:56:05+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "https://seld.be"
}
],
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
"homepage": "https://github.com/Seldaek/monolog",
"keywords": [
"log",
"logging",
"psr-3"
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/3.10.0"
},
"funding": [
{
"url": "https://github.com/Seldaek",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
"type": "tidelift"
}
],
"install-path": "../monolog/monolog"
},
{
"name": "paragonie/constant_time_encoding",
"version": "v3.1.3",
"version_normalized": "3.1.3.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/constant_time_encoding.git",
"reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77",
"reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77",
"shasum": ""
},
"require": {
"php": "^8"
},
"require-dev": {
"infection/infection": "^0",
"nikic/php-fuzzer": "^0",
"phpunit/phpunit": "^9|^10|^11",
"vimeo/psalm": "^4|^5|^6"
},
"time": "2025-09-24T15:06:41+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"ParagonIE\\ConstantTime\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com",
"role": "Maintainer"
},
{
"name": "Steve 'Sc00bz' Thomas",
"email": "steve@tobtu.com",
"homepage": "https://www.tobtu.com",
"role": "Original Developer"
}
],
"description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)",
"keywords": [
"base16",
"base32",
"base32_decode",
"base32_encode",
"base64",
"base64_decode",
"base64_encode",
"bin2hex",
"encoding",
"hex",
"hex2bin",
"rfc4648"
],
"support": {
"email": "info@paragonie.com",
"issues": "https://github.com/paragonie/constant_time_encoding/issues",
"source": "https://github.com/paragonie/constant_time_encoding"
},
"install-path": "../paragonie/constant_time_encoding"
},
{
"name": "paragonie/random_compat",
"version": "v9.99.100",
"version_normalized": "9.99.100.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
"shasum": ""
},
"require": {
"php": ">= 7"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*",
"vimeo/psalm": "^1"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"time": "2020-10-15T08:29:30+00:00",
"type": "library",
"installation-source": "dist",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"polyfill",
"pseudorandom",
"random"
],
"support": {
"email": "info@paragonie.com",
"issues": "https://github.com/paragonie/random_compat/issues",
"source": "https://github.com/paragonie/random_compat"
},
"install-path": "../paragonie/random_compat"
},
{
"name": "phpseclib/phpseclib",
"version": "3.0.48",
"version_normalized": "3.0.48.0",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "64065a5679c50acb886e82c07aa139b0f757bb89"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/64065a5679c50acb886e82c07aa139b0f757bb89",
"reference": "64065a5679c50acb886e82c07aa139b0f757bb89",
"shasum": ""
},
"require": {
"paragonie/constant_time_encoding": "^1|^2|^3",
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
"php": ">=5.6.1"
},
"require-dev": {
"phpunit/phpunit": "*"
},
"suggest": {
"ext-dom": "Install the DOM extension to load XML formatted public keys.",
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
"ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
},
"time": "2025-12-15T11:51:42+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"phpseclib/bootstrap.php"
],
"psr-4": {
"phpseclib3\\": "phpseclib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jim Wigginton",
"email": "terrafrost@php.net",
"role": "Lead Developer"
},
{
"name": "Patrick Monnerat",
"email": "pm@datasphere.ch",
"role": "Developer"
},
{
"name": "Andreas Fischer",
"email": "bantu@phpbb.com",
"role": "Developer"
},
{
"name": "Hans-Jürgen Petrich",
"email": "petrich@tronic-media.com",
"role": "Developer"
},
{
"name": "Graham Campbell",
"email": "graham@alt-three.com",
"role": "Developer"
}
],
"description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
"homepage": "http://phpseclib.sourceforge.net",
"keywords": [
"BigInteger",
"aes",
"asn.1",
"asn1",
"blowfish",
"crypto",
"cryptography",
"encryption",
"rsa",
"security",
"sftp",
"signature",
"signing",
"ssh",
"twofish",
"x.509",
"x509"
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.48"
},
"funding": [
{
"url": "https://github.com/terrafrost",
"type": "github"
},
{
"url": "https://www.patreon.com/phpseclib",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib",
"type": "tidelift"
}
],
"install-path": "../phpseclib/phpseclib"
},
{
"name": "psr/cache",
"version": "3.0.0",
"version_normalized": "3.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"time": "2021-02-03T23:26:27+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"support": {
"source": "https://github.com/php-fig/cache/tree/3.0.0"
},
"install-path": "../psr/cache"
},
{
"name": "psr/http-client",
"version": "1.0.3",
"version_normalized": "1.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0 || ^2.0"
},
"time": "2023-09-23T14:17:50+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client"
},
"install-path": "../psr/http-client"
},
{
"name": "psr/http-factory",
"version": "1.1.0",
"version_normalized": "1.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": ""
},
"require": {
"php": ">=7.1",
"psr/http-message": "^1.0 || ^2.0"
},
"time": "2024-04-15T12:06:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory"
},
"install-path": "../psr/http-factory"
},
{
"name": "psr/http-message",
"version": "2.0",
"version_normalized": "2.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"time": "2023-04-04T09:54:51+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/2.0"
},
"install-path": "../psr/http-message"
},
{
"name": "psr/log",
"version": "3.0.2",
"version_normalized": "3.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"time": "2024-09-11T13:17:53+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Log\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/3.0.2"
},
"install-path": "../psr/log"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
"version_normalized": "3.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/ralouphie/getallheaders.git",
"reference": "120b605dfeb996808c31b6477290a714d356e822"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5 || ^6.5"
},
"time": "2019-03-08T08:55:37+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"src/getallheaders.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"description": "A polyfill for getallheaders.",
"support": {
"issues": "https://github.com/ralouphie/getallheaders/issues",
"source": "https://github.com/ralouphie/getallheaders/tree/develop"
},
"install-path": "../ralouphie/getallheaders"
},
{
"name": "ramsey/collection",
"version": "2.1.1",
"version_normalized": "2.1.1.0",
"source": {
"type": "git",
"url": "https://github.com/ramsey/collection.git",
"reference": "344572933ad0181accbf4ba763e85a0306a8c5e2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2",
"reference": "344572933ad0181accbf4ba763e85a0306a8c5e2",
"shasum": ""
},
"require": {
"php": "^8.1"
},
"require-dev": {
"captainhook/plugin-composer": "^5.3",
"ergebnis/composer-normalize": "^2.45",
"fakerphp/faker": "^1.24",
"hamcrest/hamcrest-php": "^2.0",
"jangregor/phpstan-prophecy": "^2.1",
"mockery/mockery": "^1.6",
"php-parallel-lint/php-console-highlighter": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpspec/prophecy-phpunit": "^2.3",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-mockery": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^10.5",
"ramsey/coding-standard": "^2.3",
"ramsey/conventional-commits": "^1.6",
"roave/security-advisories": "dev-latest"
},
"time": "2025-03-22T05:38:12+00:00",
"type": "library",
"extra": {
"captainhook": {
"force-install": true
},
"ramsey/conventional-commits": {
"configFile": "conventional-commits.json"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Ramsey\\Collection\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ben Ramsey",
"email": "ben@benramsey.com",
"homepage": "https://benramsey.com"
}
],
"description": "A PHP library for representing and manipulating collections.",
"keywords": [
"array",
"collection",
"hash",
"map",
"queue",
"set"
],
"support": {
"issues": "https://github.com/ramsey/collection/issues",
"source": "https://github.com/ramsey/collection/tree/2.1.1"
},
"install-path": "../ramsey/collection"
},
{
"name": "ramsey/uuid",
"version": "4.9.2",
"version_normalized": "4.9.2.0",
"source": {
"type": "git",
"url": "https://github.com/ramsey/uuid.git",
"reference": "8429c78ca35a09f27565311b98101e2826affde0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/8429c78ca35a09f27565311b98101e2826affde0",
"reference": "8429c78ca35a09f27565311b98101e2826affde0",
"shasum": ""
},
"require": {
"brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14",
"php": "^8.0",
"ramsey/collection": "^1.2 || ^2.0"
},
"replace": {
"rhumsaa/uuid": "self.version"
},
"require-dev": {
"captainhook/captainhook": "^5.25",
"captainhook/plugin-composer": "^5.3",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"ergebnis/composer-normalize": "^2.47",
"mockery/mockery": "^1.6",
"paragonie/random-lib": "^2",
"php-mock/php-mock": "^2.6",
"php-mock/php-mock-mockery": "^1.5",
"php-parallel-lint/php-parallel-lint": "^1.4.0",
"phpbench/phpbench": "^1.2.14",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-mockery": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^9.6",
"slevomat/coding-standard": "^8.18",
"squizlabs/php_codesniffer": "^3.13"
},
"suggest": {
"ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.",
"ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.",
"ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.",
"paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter",
"ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type."
},
"time": "2025-12-14T04:43:48+00:00",
"type": "library",
"extra": {
"captainhook": {
"force-install": true
}
},
"installation-source": "dist",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Ramsey\\Uuid\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A PHP library for generating and working with universally unique identifiers (UUIDs).",
"keywords": [
"guid",
"identifier",
"uuid"
],
"support": {
"issues": "https://github.com/ramsey/uuid/issues",
"source": "https://github.com/ramsey/uuid/tree/4.9.2"
},
"install-path": "../ramsey/uuid"
},
{
"name": "rize/uri-template",
"version": "0.4.1",
"version_normalized": "0.4.1.0",
"source": {
"type": "git",
"url": "https://github.com/rize/UriTemplate.git",
"reference": "abb53c8b73a5b6c24e11f49036ab842f560cad33"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rize/UriTemplate/zipball/abb53c8b73a5b6c24e11f49036ab842f560cad33",
"reference": "abb53c8b73a5b6c24e11f49036ab842f560cad33",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.63",
"phpstan/phpstan": "^1.12",
"phpunit/phpunit": "~10.0"
},
"time": "2025-12-02T15:19:04+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Rize\\": "src/Rize"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marut K",
"homepage": "http://twitter.com/rezigned"
}
],
"description": "PHP URI Template (RFC 6570) supports both expansion & extraction",
"keywords": [
"RFC 6570",
"template",
"uri"
],
"support": {
"issues": "https://github.com/rize/UriTemplate/issues",
"source": "https://github.com/rize/UriTemplate/tree/0.4.1"
},
"funding": [
{
"url": "https://www.paypal.me/rezigned",
"type": "custom"
},
{
"url": "https://github.com/rezigned",
"type": "github"
},
{
"url": "https://opencollective.com/rize-uri-template",
"type": "open_collective"
}
],
"install-path": "../rize/uri-template"
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.6.0",
"version_normalized": "3.6.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62",
"reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"time": "2024-09-25T14:21:43+00:00",
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.6-dev"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/deprecation-contracts"
}
],
"dev": false,
"dev-package-names": []
}
================================================
FILE: lib/Google/vendor/composer/installed.php
================================================
array(
'name' => 'google/apiclient',
'pretty_version' => 'dev-latest',
'version' => 'dev-latest',
'reference' => '9c990229a1ed5cd1870e57633f92abd945628365',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => false,
),
'versions' => array(
'brick/math' => array(
'pretty_version' => '0.13.1',
'version' => '0.13.1.0',
'reference' => 'fc7ed316430118cc7836bf45faff18d5dfc8de04',
'type' => 'library',
'install_path' => __DIR__ . '/../brick/math',
'aliases' => array(),
'dev_requirement' => false,
),
'firebase/php-jwt' => array(
'pretty_version' => 'v7.0.2',
'version' => '7.0.2.0',
'reference' => '5645b43af647b6947daac1d0f659dd1fbe8d3b65',
'type' => 'library',
'install_path' => __DIR__ . '/../firebase/php-jwt',
'aliases' => array(),
'dev_requirement' => false,
),
'google/apiclient' => array(
'pretty_version' => 'dev-latest',
'version' => 'dev-latest',
'reference' => '9c990229a1ed5cd1870e57633f92abd945628365',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'google/apiclient-services' => array(
'pretty_version' => 'v0.427.0',
'version' => '0.427.0.0',
'reference' => 'cc74cd104a1ed1cf545480c52f13831e6eb0efe2',
'type' => 'library',
'install_path' => __DIR__ . '/../google/apiclient-services',
'aliases' => array(),
'dev_requirement' => false,
),
'google/auth' => array(
'pretty_version' => 'v1.50.0',
'version' => '1.50.0.0',
'reference' => 'e1c26a718198e16d8a3c69b1cae136b73f959b0f',
'type' => 'library',
'install_path' => __DIR__ . '/../google/auth',
'aliases' => array(),
'dev_requirement' => false,
),
'google/cloud-core' => array(
'pretty_version' => 'v1.69.0',
'version' => '1.69.0.0',
'reference' => 'a35bcf9d79f7007eaaf325e00011d08f40494fb1',
'type' => 'library',
'install_path' => __DIR__ . '/../google/cloud-core',
'aliases' => array(),
'dev_requirement' => false,
),
'google/cloud-storage' => array(
'pretty_version' => 'v1.49.0',
'version' => '1.49.0.0',
'reference' => '30aefa19ce5af165cef8bb39c224cfa865461541',
'type' => 'library',
'install_path' => __DIR__ . '/../google/cloud-storage',
'aliases' => array(),
'dev_requirement' => false,
),
'google/common-protos' => array(
'pretty_version' => '4.12.4',
'version' => '4.12.4.0',
'reference' => '0127156899af0df2681bd42024c60bd5360d64e3',
'type' => 'library',
'install_path' => __DIR__ . '/../google/common-protos',
'aliases' => array(),
'dev_requirement' => false,
),
'google/gax' => array(
'pretty_version' => 'v1.40.0',
'version' => '1.40.0.0',
'reference' => '1d3834d60b3f0794427c64d2b27d7c627fbba92c',
'type' => 'library',
'install_path' => __DIR__ . '/../google/gax',
'aliases' => array(),
'dev_requirement' => false,
),
'google/grpc-gcp' => array(
'pretty_version' => 'v0.4.1',
'version' => '0.4.1.0',
'reference' => 'e585b7721bbe806ef45b5c52ae43dfc2bff89968',
'type' => 'library',
'install_path' => __DIR__ . '/../google/grpc-gcp',
'aliases' => array(),
'dev_requirement' => false,
),
'google/longrunning' => array(
'pretty_version' => '0.6.0',
'version' => '0.6.0.0',
'reference' => '226d3b5166eaa13754cc5e452b37872478e23375',
'type' => 'library',
'install_path' => __DIR__ . '/../google/longrunning',
'aliases' => array(),
'dev_requirement' => false,
),
'google/protobuf' => array(
'pretty_version' => 'v4.33.2',
'version' => '4.33.2.0',
'reference' => 'fbd96b7bf1343f4b0d8fb358526c7ba4d72f1318',
'type' => 'library',
'install_path' => __DIR__ . '/../google/protobuf',
'aliases' => array(),
'dev_requirement' => false,
),
'grpc/grpc' => array(
'pretty_version' => '1.74.0',
'version' => '1.74.0.0',
'reference' => '32bf4dba256d60d395582fb6e4e8d3936bcdb713',
'type' => 'library',
'install_path' => __DIR__ . '/../grpc/grpc',
'aliases' => array(),
'dev_requirement' => false,
),
'guzzlehttp/guzzle' => array(
'pretty_version' => '7.10.0',
'version' => '7.10.0.0',
'reference' => 'b51ac707cfa420b7bfd4e4d5e510ba8008e822b4',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
'aliases' => array(),
'dev_requirement' => false,
),
'guzzlehttp/promises' => array(
'pretty_version' => '2.3.0',
'version' => '2.3.0.0',
'reference' => '481557b130ef3790cf82b713667b43030dc9c957',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/promises',
'aliases' => array(),
'dev_requirement' => false,
),
'guzzlehttp/psr7' => array(
'pretty_version' => '2.8.0',
'version' => '2.8.0.0',
'reference' => '21dc724a0583619cd1652f673303492272778051',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(),
'dev_requirement' => false,
),
'monolog/monolog' => array(
'pretty_version' => '3.10.0',
'version' => '3.10.0.0',
'reference' => 'b321dd6749f0bf7189444158a3ce785cc16d69b0',
'type' => 'library',
'install_path' => __DIR__ . '/../monolog/monolog',
'aliases' => array(),
'dev_requirement' => false,
),
'paragonie/constant_time_encoding' => array(
'pretty_version' => 'v3.1.3',
'version' => '3.1.3.0',
'reference' => 'd5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77',
'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/constant_time_encoding',
'aliases' => array(),
'dev_requirement' => false,
),
'paragonie/random_compat' => array(
'pretty_version' => 'v9.99.100',
'version' => '9.99.100.0',
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/random_compat',
'aliases' => array(),
'dev_requirement' => false,
),
'phpseclib/phpseclib' => array(
'pretty_version' => '3.0.48',
'version' => '3.0.48.0',
'reference' => '64065a5679c50acb886e82c07aa139b0f757bb89',
'type' => 'library',
'install_path' => __DIR__ . '/../phpseclib/phpseclib',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/cache' => array(
'pretty_version' => '3.0.0',
'version' => '3.0.0.0',
'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/cache',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/http-client' => array(
'pretty_version' => '1.0.3',
'version' => '1.0.3.0',
'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-client',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/http-client-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0',
),
),
'psr/http-factory' => array(
'pretty_version' => '1.1.0',
'version' => '1.1.0.0',
'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-factory',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/http-factory-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0',
),
),
'psr/http-message' => array(
'pretty_version' => '2.0',
'version' => '2.0.0.0',
'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/http-message-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0',
),
),
'psr/log' => array(
'pretty_version' => '3.0.2',
'version' => '3.0.2.0',
'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/log-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '3.0.0',
),
),
'ralouphie/getallheaders' => array(
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
'type' => 'library',
'install_path' => __DIR__ . '/../ralouphie/getallheaders',
'aliases' => array(),
'dev_requirement' => false,
),
'ramsey/collection' => array(
'pretty_version' => '2.1.1',
'version' => '2.1.1.0',
'reference' => '344572933ad0181accbf4ba763e85a0306a8c5e2',
'type' => 'library',
'install_path' => __DIR__ . '/../ramsey/collection',
'aliases' => array(),
'dev_requirement' => false,
),
'ramsey/uuid' => array(
'pretty_version' => '4.9.2',
'version' => '4.9.2.0',
'reference' => '8429c78ca35a09f27565311b98101e2826affde0',
'type' => 'library',
'install_path' => __DIR__ . '/../ramsey/uuid',
'aliases' => array(),
'dev_requirement' => false,
),
'rhumsaa/uuid' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '4.9.2',
),
),
'rize/uri-template' => array(
'pretty_version' => '0.4.1',
'version' => '0.4.1.0',
'reference' => 'abb53c8b73a5b6c24e11f49036ab842f560cad33',
'type' => 'library',
'install_path' => __DIR__ . '/../rize/uri-template',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/deprecation-contracts' => array(
'pretty_version' => 'v3.6.0',
'version' => '3.6.0.0',
'reference' => '63afe740e99a13ba87ec199bb07bbdee937a5b62',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
),
);
================================================
FILE: lib/Google/vendor/composer/platform_check.php
================================================
= 80100)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
throw new \RuntimeException(
'Composer detected issues in your platform: ' . implode(' ', $issues)
);
}
================================================
FILE: lib/Google/vendor/firebase/php-jwt/CHANGELOG.md
================================================
# Changelog
## [7.0.2](https://github.com/firebase/php-jwt/compare/v7.0.1...v7.0.2) (2025-12-16)
### Bug Fixes
* add key length validation for ec keys ([#615](https://github.com/firebase/php-jwt/issues/615)) ([7044f9a](https://github.com/firebase/php-jwt/commit/7044f9ae7e7d175d28cca71714feb236f1c0e252))
## [7.0.0](https://github.com/firebase/php-jwt/compare/v6.11.1...v7.0.0) (2025-12-15)
### ⚠️ ⚠️ ⚠️ Security Fixes ⚠️ ⚠️ ⚠️
* add key size validation ([#613](https://github.com/firebase/php-jwt/issues/613)) ([6b80341](https://github.com/firebase/php-jwt/commit/6b80341bf57838ea2d011487917337901cd71576))
**NOTE**: This fix will cause keys with a size below the minimally allowed size to break.
### Features
* add SensitiveParameter attribute to security-critical parameters ([#603](https://github.com/firebase/php-jwt/issues/603)) ([4dbfac0](https://github.com/firebase/php-jwt/commit/4dbfac0260eeb0e9e643063c99998e3219cc539b))
* store timestamp in `ExpiredException` ([#604](https://github.com/firebase/php-jwt/issues/604)) ([f174826](https://github.com/firebase/php-jwt/commit/f1748260d218a856b6a0c23715ac7fae1d7ca95b))
### Bug Fixes
* validate iat and nbf on payload ([#568](https://github.com/firebase/php-jwt/issues/568)) ([953b2c8](https://github.com/firebase/php-jwt/commit/953b2c88bb445b7e3bb82a5141928f13d7343afd))
## [6.11.1](https://github.com/firebase/php-jwt/compare/v6.11.0...v6.11.1) (2025-04-09)
### Bug Fixes
* update error text for consistency ([#528](https://github.com/firebase/php-jwt/issues/528)) ([c11113a](https://github.com/firebase/php-jwt/commit/c11113afa13265e016a669e75494b9203b8a7775))
## [6.11.0](https://github.com/firebase/php-jwt/compare/v6.10.2...v6.11.0) (2025-01-23)
### Features
* support octet typed JWK ([#587](https://github.com/firebase/php-jwt/issues/587)) ([7cb8a26](https://github.com/firebase/php-jwt/commit/7cb8a265fa81edf2fa6ef8098f5bc5ae573c33ad))
### Bug Fixes
* refactor constructor Key to use PHP 8.0 syntax ([#577](https://github.com/firebase/php-jwt/issues/577)) ([29fa2ce](https://github.com/firebase/php-jwt/commit/29fa2ce9e0582cd397711eec1e80c05ce20fabca))
## [6.10.2](https://github.com/firebase/php-jwt/compare/v6.10.1...v6.10.2) (2024-11-24)
### Bug Fixes
* Mitigate PHP8.4 deprecation warnings ([#570](https://github.com/firebase/php-jwt/issues/570)) ([76808fa](https://github.com/firebase/php-jwt/commit/76808fa227f3811aa5cdb3bf81233714b799a5b5))
* support php 8.4 ([#583](https://github.com/firebase/php-jwt/issues/583)) ([e3d68b0](https://github.com/firebase/php-jwt/commit/e3d68b044421339443c74199edd020e03fb1887e))
## [6.10.1](https://github.com/firebase/php-jwt/compare/v6.10.0...v6.10.1) (2024-05-18)
### Bug Fixes
* ensure ratelimit expiry is set every time ([#556](https://github.com/firebase/php-jwt/issues/556)) ([09cb208](https://github.com/firebase/php-jwt/commit/09cb2081c2c3bc0f61e2f2a5fbea5741f7498648))
* ratelimit cache expiration ([#550](https://github.com/firebase/php-jwt/issues/550)) ([dda7250](https://github.com/firebase/php-jwt/commit/dda725033585ece30ff8cae8937320d7e9f18bae))
## [6.10.0](https://github.com/firebase/php-jwt/compare/v6.9.0...v6.10.0) (2023-11-28)
### Features
* allow typ header override ([#546](https://github.com/firebase/php-jwt/issues/546)) ([79cb30b](https://github.com/firebase/php-jwt/commit/79cb30b729a22931b2fbd6b53f20629a83031ba9))
## [6.9.0](https://github.com/firebase/php-jwt/compare/v6.8.1...v6.9.0) (2023-10-04)
### Features
* add payload to jwt exception ([#521](https://github.com/firebase/php-jwt/issues/521)) ([175edf9](https://github.com/firebase/php-jwt/commit/175edf958bb61922ec135b2333acf5622f2238a2))
## [6.8.1](https://github.com/firebase/php-jwt/compare/v6.8.0...v6.8.1) (2023-07-14)
### Bug Fixes
* accept float claims but round down to ignore them ([#492](https://github.com/firebase/php-jwt/issues/492)) ([3936842](https://github.com/firebase/php-jwt/commit/39368423beeaacb3002afa7dcb75baebf204fe7e))
* different BeforeValidException messages for nbf and iat ([#526](https://github.com/firebase/php-jwt/issues/526)) ([0a53cf2](https://github.com/firebase/php-jwt/commit/0a53cf2986e45c2bcbf1a269f313ebf56a154ee4))
## [6.8.0](https://github.com/firebase/php-jwt/compare/v6.7.0...v6.8.0) (2023-06-14)
### Features
* add support for P-384 curve ([#515](https://github.com/firebase/php-jwt/issues/515)) ([5de4323](https://github.com/firebase/php-jwt/commit/5de4323f4baf4d70bca8663bd87682a69c656c3d))
### Bug Fixes
* handle invalid http responses ([#508](https://github.com/firebase/php-jwt/issues/508)) ([91c39c7](https://github.com/firebase/php-jwt/commit/91c39c72b22fc3e1191e574089552c1f2041c718))
## [6.7.0](https://github.com/firebase/php-jwt/compare/v6.6.0...v6.7.0) (2023-06-14)
### Features
* add ed25519 support to JWK (public keys) ([#452](https://github.com/firebase/php-jwt/issues/452)) ([e53979a](https://github.com/firebase/php-jwt/commit/e53979abae927de916a75b9d239cfda8ce32be2a))
## [6.6.0](https://github.com/firebase/php-jwt/compare/v6.5.0...v6.6.0) (2023-06-13)
### Features
* allow get headers when decoding token ([#442](https://github.com/firebase/php-jwt/issues/442)) ([fb85f47](https://github.com/firebase/php-jwt/commit/fb85f47cfaeffdd94faf8defdf07164abcdad6c3))
### Bug Fixes
* only check iat if nbf is not used ([#493](https://github.com/firebase/php-jwt/issues/493)) ([398ccd2](https://github.com/firebase/php-jwt/commit/398ccd25ea12fa84b9e4f1085d5ff448c21ec797))
## [6.5.0](https://github.com/firebase/php-jwt/compare/v6.4.0...v6.5.0) (2023-05-12)
### Bug Fixes
* allow KID of '0' ([#505](https://github.com/firebase/php-jwt/issues/505)) ([9dc46a9](https://github.com/firebase/php-jwt/commit/9dc46a9c3e5801294249cfd2554c5363c9f9326a))
### Miscellaneous Chores
* drop support for PHP 7.3 ([#495](https://github.com/firebase/php-jwt/issues/495))
## [6.4.0](https://github.com/firebase/php-jwt/compare/v6.3.2...v6.4.0) (2023-02-08)
### Features
* add support for W3C ES256K ([#462](https://github.com/firebase/php-jwt/issues/462)) ([213924f](https://github.com/firebase/php-jwt/commit/213924f51936291fbbca99158b11bd4ae56c2c95))
* improve caching by only decoding jwks when necessary ([#486](https://github.com/firebase/php-jwt/issues/486)) ([78d3ed1](https://github.com/firebase/php-jwt/commit/78d3ed1073553f7d0bbffa6c2010009a0d483d5c))
## [6.3.2](https://github.com/firebase/php-jwt/compare/v6.3.1...v6.3.2) (2022-11-01)
### Bug Fixes
* check kid before using as array index ([bad1b04](https://github.com/firebase/php-jwt/commit/bad1b040d0c736bbf86814c6b5ae614f517cf7bd))
## [6.3.1](https://github.com/firebase/php-jwt/compare/v6.3.0...v6.3.1) (2022-11-01)
### Bug Fixes
* casing of GET for PSR compat ([#451](https://github.com/firebase/php-jwt/issues/451)) ([60b52b7](https://github.com/firebase/php-jwt/commit/60b52b71978790eafcf3b95cfbd83db0439e8d22))
* string interpolation format for php 8.2 ([#446](https://github.com/firebase/php-jwt/issues/446)) ([2e07d8a](https://github.com/firebase/php-jwt/commit/2e07d8a1524d12b69b110ad649f17461d068b8f2))
## 6.3.0 / 2022-07-15
- Added ES256 support to JWK parsing ([#399](https://github.com/firebase/php-jwt/pull/399))
- Fixed potential caching error in `CachedKeySet` by caching jwks as strings ([#435](https://github.com/firebase/php-jwt/pull/435))
## 6.2.0 / 2022-05-14
- Added `CachedKeySet` ([#397](https://github.com/firebase/php-jwt/pull/397))
- Added `$defaultAlg` parameter to `JWT::parseKey` and `JWT::parseKeySet` ([#426](https://github.com/firebase/php-jwt/pull/426)).
## 6.1.0 / 2022-03-23
- Drop support for PHP 5.3, 5.4, 5.5, 5.6, and 7.0
- Add parameter typing and return types where possible
## 6.0.0 / 2022-01-24
- **Backwards-Compatibility Breaking Changes**: See the [Release Notes](https://github.com/firebase/php-jwt/releases/tag/v6.0.0) for more information.
- New Key object to prevent key/algorithm type confusion (#365)
- Add JWK support (#273)
- Add ES256 support (#256)
- Add ES384 support (#324)
- Add Ed25519 support (#343)
## 5.0.0 / 2017-06-26
- Support RS384 and RS512.
See [#117](https://github.com/firebase/php-jwt/pull/117). Thanks [@joostfaassen](https://github.com/joostfaassen)!
- Add an example for RS256 openssl.
See [#125](https://github.com/firebase/php-jwt/pull/125). Thanks [@akeeman](https://github.com/akeeman)!
- Detect invalid Base64 encoding in signature.
See [#162](https://github.com/firebase/php-jwt/pull/162). Thanks [@psignoret](https://github.com/psignoret)!
- Update `JWT::verify` to handle OpenSSL errors.
See [#159](https://github.com/firebase/php-jwt/pull/159). Thanks [@bshaffer](https://github.com/bshaffer)!
- Add `array` type hinting to `decode` method
See [#101](https://github.com/firebase/php-jwt/pull/101). Thanks [@hywak](https://github.com/hywak)!
- Add all JSON error types.
See [#110](https://github.com/firebase/php-jwt/pull/110). Thanks [@gbalduzzi](https://github.com/gbalduzzi)!
- Bugfix 'kid' not in given key list.
See [#129](https://github.com/firebase/php-jwt/pull/129). Thanks [@stampycode](https://github.com/stampycode)!
- Miscellaneous cleanup, documentation and test fixes.
See [#107](https://github.com/firebase/php-jwt/pull/107), [#115](https://github.com/firebase/php-jwt/pull/115),
[#160](https://github.com/firebase/php-jwt/pull/160), [#161](https://github.com/firebase/php-jwt/pull/161), and
[#165](https://github.com/firebase/php-jwt/pull/165). Thanks [@akeeman](https://github.com/akeeman),
[@chinedufn](https://github.com/chinedufn), and [@bshaffer](https://github.com/bshaffer)!
## 4.0.0 / 2016-07-17
- Add support for late static binding. See [#88](https://github.com/firebase/php-jwt/pull/88) for details. Thanks to [@chappy84](https://github.com/chappy84)!
- Use static `$timestamp` instead of `time()` to improve unit testing. See [#93](https://github.com/firebase/php-jwt/pull/93) for details. Thanks to [@josephmcdermott](https://github.com/josephmcdermott)!
- Fixes to exceptions classes. See [#81](https://github.com/firebase/php-jwt/pull/81) for details. Thanks to [@Maks3w](https://github.com/Maks3w)!
- Fixes to PHPDoc. See [#76](https://github.com/firebase/php-jwt/pull/76) for details. Thanks to [@akeeman](https://github.com/akeeman)!
## 3.0.0 / 2015-07-22
- Minimum PHP version updated from `5.2.0` to `5.3.0`.
- Add `\Firebase\JWT` namespace. See
[#59](https://github.com/firebase/php-jwt/pull/59) for details. Thanks to
[@Dashron](https://github.com/Dashron)!
- Require a non-empty key to decode and verify a JWT. See
[#60](https://github.com/firebase/php-jwt/pull/60) for details. Thanks to
[@sjones608](https://github.com/sjones608)!
- Cleaner documentation blocks in the code. See
[#62](https://github.com/firebase/php-jwt/pull/62) for details. Thanks to
[@johanderuijter](https://github.com/johanderuijter)!
## 2.2.0 / 2015-06-22
- Add support for adding custom, optional JWT headers to `JWT::encode()`. See
[#53](https://github.com/firebase/php-jwt/pull/53/files) for details. Thanks to
[@mcocaro](https://github.com/mcocaro)!
## 2.1.0 / 2015-05-20
- Add support for adding a leeway to `JWT:decode()` that accounts for clock skew
between signing and verifying entities. Thanks to [@lcabral](https://github.com/lcabral)!
- Add support for passing an object implementing the `ArrayAccess` interface for
`$keys` argument in `JWT::decode()`. Thanks to [@aztech-dev](https://github.com/aztech-dev)!
## 2.0.0 / 2015-04-01
- **Note**: It is strongly recommended that you update to > v2.0.0 to address
known security vulnerabilities in prior versions when both symmetric and
asymmetric keys are used together.
- Update signature for `JWT::decode(...)` to require an array of supported
algorithms to use when verifying token signatures.
================================================
FILE: lib/Google/vendor/firebase/php-jwt/LICENSE
================================================
Copyright (c) 2011, Neuman Vong
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the copyright holder nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================
FILE: lib/Google/vendor/firebase/php-jwt/README.md
================================================

[](https://packagist.org/packages/firebase/php-jwt)
[](https://packagist.org/packages/firebase/php-jwt)
[](https://packagist.org/packages/firebase/php-jwt)
PHP-JWT
=======
A simple library to encode and decode JSON Web Tokens (JWT) in PHP, conforming to [RFC 7519](https://tools.ietf.org/html/rfc7519).
Installation
------------
Use composer to manage your dependencies and download PHP-JWT:
```bash
composer require firebase/php-jwt
```
Optionally, install the `paragonie/sodium_compat` package from composer if your
php env does not have libsodium installed:
```bash
composer require paragonie/sodium_compat
```
Example
-------
```php
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
$key = 'example_key';
$payload = [
'iss' => 'http://example.org',
'aud' => 'http://example.com',
'iat' => 1356999524,
'nbf' => 1357000000
];
/**
* IMPORTANT:
* You must specify supported algorithms for your application. See
* https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
* for a list of spec-compliant algorithms.
*/
$jwt = JWT::encode($payload, $key, 'HS256');
$decoded = JWT::decode($jwt, new Key($key, 'HS256'));
print_r($decoded);
// Pass a stdClass in as the third parameter to get the decoded header values
$headers = new stdClass();
$decoded = JWT::decode($jwt, new Key($key, 'HS256'), $headers);
print_r($headers);
/*
NOTE: This will now be an object instead of an associative array. To get
an associative array, you will need to cast it as such:
*/
$decoded_array = (array) $decoded;
/**
* You can add a leeway to account for when there is a clock skew times between
* the signing and verifying servers. It is recommended that this leeway should
* not be bigger than a few minutes.
*
* Source: http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#nbfDef
*/
JWT::$leeway = 60; // $leeway in seconds
$decoded = JWT::decode($jwt, new Key($key, 'HS256'));
```
Example encode/decode headers
-------
Decoding the JWT headers without verifying the JWT first is NOT recommended, and is not supported by
this library. This is because without verifying the JWT, the header values could have been tampered with.
Any value pulled from an unverified header should be treated as if it could be any string sent in from an
attacker. If this is something you still want to do in your application for whatever reason, it's possible to
decode the header values manually simply by calling `json_decode` and `base64_decode` on the JWT
header part:
```php
use Firebase\JWT\JWT;
$key = 'example_key';
$payload = [
'iss' => 'http://example.org',
'aud' => 'http://example.com',
'iat' => 1356999524,
'nbf' => 1357000000
];
$headers = [
'x-forwarded-for' => 'www.google.com'
];
// Encode headers in the JWT string
$jwt = JWT::encode($payload, $key, 'HS256', null, $headers);
// Decode headers from the JWT string WITHOUT validation
// **IMPORTANT**: This operation is vulnerable to attacks, as the JWT has not yet been verified.
// These headers could be any value sent by an attacker.
list($headersB64, $payloadB64, $sig) = explode('.', $jwt);
$decoded = json_decode(base64_decode($headersB64), true);
print_r($decoded);
```
Example with RS256 (openssl)
----------------------------
```php
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
$privateKey = << 'example.org',
'aud' => 'example.com',
'iat' => 1356999524,
'nbf' => 1357000000
];
$jwt = JWT::encode($payload, $privateKey, 'RS256');
echo "Encode:\n" . print_r($jwt, true) . "\n";
$decoded = JWT::decode($jwt, new Key($publicKey, 'RS256'));
/*
NOTE: This will now be an object instead of an associative array. To get
an associative array, you will need to cast it as such:
*/
$decoded_array = (array) $decoded;
echo "Decode:\n" . print_r($decoded_array, true) . "\n";
```
Example with a passphrase
-------------------------
```php
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
// Your passphrase
$passphrase = '[YOUR_PASSPHRASE]';
// Your private key file with passphrase
// Can be generated with "ssh-keygen -t rsa -m pem"
$privateKeyFile = '/path/to/key-with-passphrase.pem';
/** @var OpenSSLAsymmetricKey $privateKey */
$privateKey = openssl_pkey_get_private(
file_get_contents($privateKeyFile),
$passphrase
);
$payload = [
'iss' => 'example.org',
'aud' => 'example.com',
'iat' => 1356999524,
'nbf' => 1357000000
];
$jwt = JWT::encode($payload, $privateKey, 'RS256');
echo "Encode:\n" . print_r($jwt, true) . "\n";
// Get public key from the private key, or pull from from a file.
$publicKey = openssl_pkey_get_details($privateKey)['key'];
$decoded = JWT::decode($jwt, new Key($publicKey, 'RS256'));
echo "Decode:\n" . print_r((array) $decoded, true) . "\n";
```
Example with EdDSA (libsodium and Ed25519 signature)
----------------------------
```php
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
// Public and private keys are expected to be Base64 encoded. The last
// non-empty line is used so that keys can be generated with
// sodium_crypto_sign_keypair(). The secret keys generated by other tools may
// need to be adjusted to match the input expected by libsodium.
$keyPair = sodium_crypto_sign_keypair();
$privateKey = base64_encode(sodium_crypto_sign_secretkey($keyPair));
$publicKey = base64_encode(sodium_crypto_sign_publickey($keyPair));
$payload = [
'iss' => 'example.org',
'aud' => 'example.com',
'iat' => 1356999524,
'nbf' => 1357000000
];
$jwt = JWT::encode($payload, $privateKey, 'EdDSA');
echo "Encode:\n" . print_r($jwt, true) . "\n";
$decoded = JWT::decode($jwt, new Key($publicKey, 'EdDSA'));
echo "Decode:\n" . print_r((array) $decoded, true) . "\n";
````
Example with multiple keys
--------------------------
```php
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
// Example RSA keys from previous example
// $privateKey1 = '...';
// $publicKey1 = '...';
// Example EdDSA keys from previous example
// $privateKey2 = '...';
// $publicKey2 = '...';
$payload = [
'iss' => 'example.org',
'aud' => 'example.com',
'iat' => 1356999524,
'nbf' => 1357000000
];
$jwt1 = JWT::encode($payload, $privateKey1, 'RS256', 'kid1');
$jwt2 = JWT::encode($payload, $privateKey2, 'EdDSA', 'kid2');
echo "Encode 1:\n" . print_r($jwt1, true) . "\n";
echo "Encode 2:\n" . print_r($jwt2, true) . "\n";
$keys = [
'kid1' => new Key($publicKey1, 'RS256'),
'kid2' => new Key($publicKey2, 'EdDSA'),
];
$decoded1 = JWT::decode($jwt1, $keys);
$decoded2 = JWT::decode($jwt2, $keys);
echo "Decode 1:\n" . print_r((array) $decoded1, true) . "\n";
echo "Decode 2:\n" . print_r((array) $decoded2, true) . "\n";
```
Using JWKs
----------
```php
use Firebase\JWT\JWK;
use Firebase\JWT\JWT;
// Set of keys. The "keys" key is required. For example, the JSON response to
// this endpoint: https://www.gstatic.com/iap/verify/public_key-jwk
$jwks = ['keys' => []];
// JWK::parseKeySet($jwks) returns an associative array of **kid** to Firebase\JWT\Key
// objects. Pass this as the second parameter to JWT::decode.
JWT::decode($jwt, JWK::parseKeySet($jwks));
```
Using Cached Key Sets
---------------------
The `CachedKeySet` class can be used to fetch and cache JWKS (JSON Web Key Sets) from a public URI.
This has the following advantages:
1. The results are cached for performance.
2. If an unrecognized key is requested, the cache is refreshed, to accomodate for key rotation.
3. If rate limiting is enabled, the JWKS URI will not make more than 10 requests a second.
```php
use Firebase\JWT\CachedKeySet;
use Firebase\JWT\JWT;
// The URI for the JWKS you wish to cache the results from
$jwksUri = 'https://www.gstatic.com/iap/verify/public_key-jwk';
// Create an HTTP client (can be any PSR-7 compatible HTTP client)
$httpClient = new GuzzleHttp\Client();
// Create an HTTP request factory (can be any PSR-17 compatible HTTP request factory)
$httpFactory = new GuzzleHttp\Psr\HttpFactory();
// Create a cache item pool (can be any PSR-6 compatible cache item pool)
$cacheItemPool = Phpfastcache\CacheManager::getInstance('files');
$keySet = new CachedKeySet(
$jwksUri,
$httpClient,
$httpFactory,
$cacheItemPool,
null, // $expiresAfter int seconds to set the JWKS to expire
true // $rateLimit true to enable rate limit of 10 RPS on lookup of invalid keys
);
$jwt = 'eyJhbGci...'; // Some JWT signed by a key from the $jwkUri above
$decoded = JWT::decode($jwt, $keySet);
```
Miscellaneous
-------------
#### Exception Handling
When a call to `JWT::decode` is invalid, it will throw one of the following exceptions:
```php
use Firebase\JWT\JWT;
use Firebase\JWT\SignatureInvalidException;
use Firebase\JWT\BeforeValidException;
use Firebase\JWT\ExpiredException;
use DomainException;
use InvalidArgumentException;
use UnexpectedValueException;
try {
$decoded = JWT::decode($jwt, $keys);
} catch (InvalidArgumentException $e) {
// provided key/key-array is empty or malformed.
} catch (DomainException $e) {
// provided algorithm is unsupported OR
// provided key is invalid OR
// unknown error thrown in openSSL or libsodium OR
// libsodium is required but not available.
} catch (SignatureInvalidException $e) {
// provided JWT signature verification failed.
} catch (BeforeValidException $e) {
// provided JWT is trying to be used before "nbf" claim OR
// provided JWT is trying to be used before "iat" claim.
} catch (ExpiredException $e) {
// provided JWT is trying to be used after "exp" claim.
} catch (UnexpectedValueException $e) {
// provided JWT is malformed OR
// provided JWT is missing an algorithm / using an unsupported algorithm OR
// provided JWT algorithm does not match provided key OR
// provided key ID in key/key-array is empty or invalid.
}
```
All exceptions in the `Firebase\JWT` namespace extend `UnexpectedValueException`, and can be simplified
like this:
```php
use Firebase\JWT\JWT;
use UnexpectedValueException;
try {
$decoded = JWT::decode($jwt, $keys);
} catch (LogicException $e) {
// errors having to do with environmental setup or malformed JWT Keys
} catch (UnexpectedValueException $e) {
// errors having to do with JWT signature and claims
}
```
#### Casting to array
The return value of `JWT::decode` is the generic PHP object `stdClass`. If you'd like to handle with arrays
instead, you can do the following:
```php
// return type is stdClass
$decoded = JWT::decode($jwt, $keys);
// cast to array
$decoded = json_decode(json_encode($decoded), true);
```
Tests
-----
Run the tests using phpunit:
```bash
$ pear install PHPUnit
$ phpunit --configuration phpunit.xml.dist
PHPUnit 3.7.10 by Sebastian Bergmann.
.....
Time: 0 seconds, Memory: 2.50Mb
OK (5 tests, 5 assertions)
```
New Lines in private keys
-----
If your private key contains `\n` characters, be sure to wrap it in double quotes `""`
and not single quotes `''` in order to properly interpret the escaped characters.
License
-------
[3-Clause BSD](http://opensource.org/licenses/BSD-3-Clause).
================================================
FILE: lib/Google/vendor/firebase/php-jwt/composer.json
================================================
{
"name": "firebase/php-jwt",
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
"homepage": "https://github.com/firebase/php-jwt",
"keywords": [
"php",
"jwt"
],
"authors": [
{
"name": "Neuman Vong",
"email": "neuman+pear@twilio.com",
"role": "Developer"
},
{
"name": "Anant Narayanan",
"email": "anant@php.net",
"role": "Developer"
}
],
"license": "BSD-3-Clause",
"require": {
"php": "^8.0"
},
"suggest": {
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present",
"ext-sodium": "Support EdDSA (Ed25519) signatures"
},
"autoload": {
"psr-4": {
"Firebase\\JWT\\": "src"
}
},
"require-dev": {
"guzzlehttp/guzzle": "^7.4",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5",
"psr/cache": "^2.0||^3.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0"
}
}
================================================
FILE: lib/Google/vendor/firebase/php-jwt/src/BeforeValidException.php
================================================
payload = $payload;
}
public function getPayload(): object
{
return $this->payload;
}
}
================================================
FILE: lib/Google/vendor/firebase/php-jwt/src/CachedKeySet.php
================================================
*/
class CachedKeySet implements ArrayAccess
{
/**
* @var string
*/
private $jwksUri;
/**
* @var ClientInterface
*/
private $httpClient;
/**
* @var RequestFactoryInterface
*/
private $httpFactory;
/**
* @var CacheItemPoolInterface
*/
private $cache;
/**
* @var ?int
*/
private $expiresAfter;
/**
* @var ?CacheItemInterface
*/
private $cacheItem;
/**
* @var array>
*/
private $keySet;
/**
* @var string
*/
private $cacheKey;
/**
* @var string
*/
private $cacheKeyPrefix = 'jwks';
/**
* @var int
*/
private $maxKeyLength = 64;
/**
* @var bool
*/
private $rateLimit;
/**
* @var string
*/
private $rateLimitCacheKey;
/**
* @var int
*/
private $maxCallsPerMinute = 10;
/**
* @var string|null
*/
private $defaultAlg;
public function __construct(
string $jwksUri,
ClientInterface $httpClient,
RequestFactoryInterface $httpFactory,
CacheItemPoolInterface $cache,
?int $expiresAfter = null,
bool $rateLimit = false,
?string $defaultAlg = null
) {
$this->jwksUri = $jwksUri;
$this->httpClient = $httpClient;
$this->httpFactory = $httpFactory;
$this->cache = $cache;
$this->expiresAfter = $expiresAfter;
$this->rateLimit = $rateLimit;
$this->defaultAlg = $defaultAlg;
$this->setCacheKeys();
}
/**
* @param string $keyId
* @return Key
*/
public function offsetGet($keyId): Key
{
if (!$this->keyIdExists($keyId)) {
throw new OutOfBoundsException('Key ID not found');
}
return JWK::parseKey($this->keySet[$keyId], $this->defaultAlg);
}
/**
* @param string $keyId
* @return bool
*/
public function offsetExists($keyId): bool
{
return $this->keyIdExists($keyId);
}
/**
* @param string $offset
* @param Key $value
*/
public function offsetSet($offset, $value): void
{
throw new LogicException('Method not implemented');
}
/**
* @param string $offset
*/
public function offsetUnset($offset): void
{
throw new LogicException('Method not implemented');
}
/**
* @return array
*/
private function formatJwksForCache(string $jwks): array
{
$jwks = json_decode($jwks, true);
if (!isset($jwks['keys'])) {
throw new UnexpectedValueException('"keys" member must exist in the JWK Set');
}
if (empty($jwks['keys'])) {
throw new InvalidArgumentException('JWK Set did not contain any keys');
}
$keys = [];
foreach ($jwks['keys'] as $k => $v) {
$kid = isset($v['kid']) ? $v['kid'] : $k;
$keys[(string) $kid] = $v;
}
return $keys;
}
private function keyIdExists(string $keyId): bool
{
if (null === $this->keySet) {
$item = $this->getCacheItem();
// Try to load keys from cache
if ($item->isHit()) {
// item found! retrieve it
$this->keySet = $item->get();
// If the cached item is a string, the JWKS response was cached (previous behavior).
// Parse this into expected format array instead.
if (\is_string($this->keySet)) {
$this->keySet = $this->formatJwksForCache($this->keySet);
}
}
}
if (!isset($this->keySet[$keyId])) {
if ($this->rateLimitExceeded()) {
return false;
}
$request = $this->httpFactory->createRequest('GET', $this->jwksUri);
$jwksResponse = $this->httpClient->sendRequest($request);
if ($jwksResponse->getStatusCode() !== 200) {
throw new UnexpectedValueException(
\sprintf('HTTP Error: %d %s for URI "%s"',
$jwksResponse->getStatusCode(),
$jwksResponse->getReasonPhrase(),
$this->jwksUri,
),
$jwksResponse->getStatusCode()
);
}
$this->keySet = $this->formatJwksForCache((string) $jwksResponse->getBody());
if (!isset($this->keySet[$keyId])) {
return false;
}
$item = $this->getCacheItem();
$item->set($this->keySet);
if ($this->expiresAfter) {
$item->expiresAfter($this->expiresAfter);
}
$this->cache->save($item);
}
return true;
}
private function rateLimitExceeded(): bool
{
if (!$this->rateLimit) {
return false;
}
$cacheItem = $this->cache->getItem($this->rateLimitCacheKey);
$cacheItemData = [];
if ($cacheItem->isHit() && \is_array($data = $cacheItem->get())) {
$cacheItemData = $data;
}
$callsPerMinute = $cacheItemData['callsPerMinute'] ?? 0;
$expiry = $cacheItemData['expiry'] ?? new \DateTime('+60 seconds', new \DateTimeZone('UTC'));
if (++$callsPerMinute > $this->maxCallsPerMinute) {
return true;
}
$cacheItem->set(['expiry' => $expiry, 'callsPerMinute' => $callsPerMinute]);
$cacheItem->expiresAt($expiry);
$this->cache->save($cacheItem);
return false;
}
private function getCacheItem(): CacheItemInterface
{
if (\is_null($this->cacheItem)) {
$this->cacheItem = $this->cache->getItem($this->cacheKey);
}
return $this->cacheItem;
}
private function setCacheKeys(): void
{
if (empty($this->jwksUri)) {
throw new RuntimeException('JWKS URI is empty');
}
// ensure we do not have illegal characters
$key = preg_replace('|[^a-zA-Z0-9_\.!]|', '', $this->jwksUri);
// add prefix
$key = $this->cacheKeyPrefix . $key;
// Hash keys if they exceed $maxKeyLength of 64
if (\strlen($key) > $this->maxKeyLength) {
$key = substr(hash('sha256', $key), 0, $this->maxKeyLength);
}
$this->cacheKey = $key;
if ($this->rateLimit) {
// add prefix
$rateLimitKey = $this->cacheKeyPrefix . 'ratelimit' . $key;
// Hash keys if they exceed $maxKeyLength of 64
if (\strlen($rateLimitKey) > $this->maxKeyLength) {
$rateLimitKey = substr(hash('sha256', $rateLimitKey), 0, $this->maxKeyLength);
}
$this->rateLimitCacheKey = $rateLimitKey;
}
}
}
================================================
FILE: lib/Google/vendor/firebase/php-jwt/src/ExpiredException.php
================================================
payload = $payload;
}
public function getPayload(): object
{
return $this->payload;
}
public function setTimestamp(int $timestamp): void
{
$this->timestamp = $timestamp;
}
public function getTimestamp(): ?int
{
return $this->timestamp;
}
}
================================================
FILE: lib/Google/vendor/firebase/php-jwt/src/JWK.php
================================================
* @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD
* @link https://github.com/firebase/php-jwt
*/
class JWK
{
private const OID = '1.2.840.10045.2.1';
private const ASN1_OBJECT_IDENTIFIER = 0x06;
private const ASN1_SEQUENCE = 0x10; // also defined in JWT
private const ASN1_BIT_STRING = 0x03;
private const EC_CURVES = [
'P-256' => '1.2.840.10045.3.1.7', // Len: 64
'secp256k1' => '1.3.132.0.10', // Len: 64
'P-384' => '1.3.132.0.34', // Len: 96
// 'P-521' => '1.3.132.0.35', // Len: 132 (not supported)
];
// For keys with "kty" equal to "OKP" (Octet Key Pair), the "crv" parameter must contain the key subtype.
// This library supports the following subtypes:
private const OKP_SUBTYPES = [
'Ed25519' => true, // RFC 8037
];
/**
* Parse a set of JWK keys
*
* @param array $jwks The JSON Web Key Set as an associative array
* @param string $defaultAlg The algorithm for the Key object if "alg" is not set in the
* JSON Web Key Set
*
* @return array An associative array of key IDs (kid) to Key objects
*
* @throws InvalidArgumentException Provided JWK Set is empty
* @throws UnexpectedValueException Provided JWK Set was invalid
* @throws DomainException OpenSSL failure
*
* @uses parseKey
*/
public static function parseKeySet(#[\SensitiveParameter] array $jwks, ?string $defaultAlg = null): array
{
$keys = [];
if (!isset($jwks['keys'])) {
throw new UnexpectedValueException('"keys" member must exist in the JWK Set');
}
if (empty($jwks['keys'])) {
throw new InvalidArgumentException('JWK Set did not contain any keys');
}
foreach ($jwks['keys'] as $k => $v) {
$kid = isset($v['kid']) ? $v['kid'] : $k;
if ($key = self::parseKey($v, $defaultAlg)) {
$keys[(string) $kid] = $key;
}
}
if (0 === \count($keys)) {
throw new UnexpectedValueException('No supported algorithms found in JWK Set');
}
return $keys;
}
/**
* Parse a JWK key
*
* @param array $jwk An individual JWK
* @param string $defaultAlg The algorithm for the Key object if "alg" is not set in the
* JSON Web Key Set
*
* @return Key The key object for the JWK
*
* @throws InvalidArgumentException Provided JWK is empty
* @throws UnexpectedValueException Provided JWK was invalid
* @throws DomainException OpenSSL failure
*
* @uses createPemFromModulusAndExponent
*/
public static function parseKey(#[\SensitiveParameter] array $jwk, ?string $defaultAlg = null): ?Key
{
if (empty($jwk)) {
throw new InvalidArgumentException('JWK must not be empty');
}
if (!isset($jwk['kty'])) {
throw new UnexpectedValueException('JWK must contain a "kty" parameter');
}
if (!isset($jwk['alg'])) {
if (\is_null($defaultAlg)) {
// The "alg" parameter is optional in a KTY, but an algorithm is required
// for parsing in this library. Use the $defaultAlg parameter when parsing the
// key set in order to prevent this error.
// @see https://datatracker.ietf.org/doc/html/rfc7517#section-4.4
throw new UnexpectedValueException('JWK must contain an "alg" parameter');
}
$jwk['alg'] = $defaultAlg;
}
switch ($jwk['kty']) {
case 'RSA':
if (!empty($jwk['d'])) {
throw new UnexpectedValueException('RSA private keys are not supported');
}
if (!isset($jwk['n']) || !isset($jwk['e'])) {
throw new UnexpectedValueException('RSA keys must contain values for both "n" and "e"');
}
$pem = self::createPemFromModulusAndExponent($jwk['n'], $jwk['e']);
$publicKey = \openssl_pkey_get_public($pem);
if (false === $publicKey) {
throw new DomainException(
'OpenSSL error: ' . \openssl_error_string()
);
}
return new Key($publicKey, $jwk['alg']);
case 'EC':
if (isset($jwk['d'])) {
// The key is actually a private key
throw new UnexpectedValueException('Key data must be for a public key');
}
if (empty($jwk['crv'])) {
throw new UnexpectedValueException('crv not set');
}
if (!isset(self::EC_CURVES[$jwk['crv']])) {
throw new DomainException('Unrecognised or unsupported EC curve');
}
if (empty($jwk['x']) || empty($jwk['y'])) {
throw new UnexpectedValueException('x and y not set');
}
$publicKey = self::createPemFromCrvAndXYCoordinates($jwk['crv'], $jwk['x'], $jwk['y']);
return new Key($publicKey, $jwk['alg']);
case 'OKP':
if (isset($jwk['d'])) {
// The key is actually a private key
throw new UnexpectedValueException('Key data must be for a public key');
}
if (!isset($jwk['crv'])) {
throw new UnexpectedValueException('crv not set');
}
if (empty(self::OKP_SUBTYPES[$jwk['crv']])) {
throw new DomainException('Unrecognised or unsupported OKP key subtype');
}
if (empty($jwk['x'])) {
throw new UnexpectedValueException('x not set');
}
// This library works internally with EdDSA keys (Ed25519) encoded in standard base64.
$publicKey = JWT::convertBase64urlToBase64($jwk['x']);
return new Key($publicKey, $jwk['alg']);
case 'oct':
if (!isset($jwk['k'])) {
throw new UnexpectedValueException('k not set');
}
return new Key(JWT::urlsafeB64Decode($jwk['k']), $jwk['alg']);
default:
break;
}
return null;
}
/**
* Converts the EC JWK values to pem format.
*
* @param string $crv The EC curve (only P-256 & P-384 is supported)
* @param string $x The EC x-coordinate
* @param string $y The EC y-coordinate
*
* @return string
*/
private static function createPemFromCrvAndXYCoordinates(string $crv, string $x, string $y): string
{
$pem =
self::encodeDER(
self::ASN1_SEQUENCE,
self::encodeDER(
self::ASN1_SEQUENCE,
self::encodeDER(
self::ASN1_OBJECT_IDENTIFIER,
self::encodeOID(self::OID)
)
. self::encodeDER(
self::ASN1_OBJECT_IDENTIFIER,
self::encodeOID(self::EC_CURVES[$crv])
)
) .
self::encodeDER(
self::ASN1_BIT_STRING,
\chr(0x00) . \chr(0x04)
. JWT::urlsafeB64Decode($x)
. JWT::urlsafeB64Decode($y)
)
);
return \sprintf(
"-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----\n",
wordwrap(base64_encode($pem), 64, "\n", true)
);
}
/**
* Create a public key represented in PEM format from RSA modulus and exponent information
*
* @param string $n The RSA modulus encoded in Base64
* @param string $e The RSA exponent encoded in Base64
*
* @return string The RSA public key represented in PEM format
*
* @uses encodeLength
*/
private static function createPemFromModulusAndExponent(
string $n,
string $e
): string {
$mod = JWT::urlsafeB64Decode($n);
$exp = JWT::urlsafeB64Decode($e);
$modulus = \pack('Ca*a*', 2, self::encodeLength(\strlen($mod)), $mod);
$publicExponent = \pack('Ca*a*', 2, self::encodeLength(\strlen($exp)), $exp);
$rsaPublicKey = \pack(
'Ca*a*a*',
48,
self::encodeLength(\strlen($modulus) + \strlen($publicExponent)),
$modulus,
$publicExponent
);
// sequence(oid(1.2.840.113549.1.1.1), null)) = rsaEncryption.
$rsaOID = \pack('H*', '300d06092a864886f70d0101010500'); // hex version of MA0GCSqGSIb3DQEBAQUA
$rsaPublicKey = \chr(0) . $rsaPublicKey;
$rsaPublicKey = \chr(3) . self::encodeLength(\strlen($rsaPublicKey)) . $rsaPublicKey;
$rsaPublicKey = \pack(
'Ca*a*',
48,
self::encodeLength(\strlen($rsaOID . $rsaPublicKey)),
$rsaOID . $rsaPublicKey
);
return "-----BEGIN PUBLIC KEY-----\r\n" .
\chunk_split(\base64_encode($rsaPublicKey), 64) .
'-----END PUBLIC KEY-----';
}
/**
* DER-encode the length
*
* DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See
* {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information.
*
* @param int $length
* @return string
*/
private static function encodeLength(int $length): string
{
if ($length <= 0x7F) {
return \chr($length);
}
$temp = \ltrim(\pack('N', $length), \chr(0));
return \pack('Ca*', 0x80 | \strlen($temp), $temp);
}
/**
* Encodes a value into a DER object.
* Also defined in Firebase\JWT\JWT
*
* @param int $type DER tag
* @param string $value the value to encode
* @return string the encoded object
*/
private static function encodeDER(int $type, string $value): string
{
$tag_header = 0;
if ($type === self::ASN1_SEQUENCE) {
$tag_header |= 0x20;
}
// Type
$der = \chr($tag_header | $type);
// Length
$der .= \chr(\strlen($value));
return $der . $value;
}
/**
* Encodes a string into a DER-encoded OID.
*
* @param string $oid the OID string
* @return string the binary DER-encoded OID
*/
private static function encodeOID(string $oid): string
{
$octets = explode('.', $oid);
// Get the first octet
$first = (int) array_shift($octets);
$second = (int) array_shift($octets);
$oid = \chr($first * 40 + $second);
// Iterate over subsequent octets
foreach ($octets as $octet) {
if ($octet == 0) {
$oid .= \chr(0x00);
continue;
}
$bin = '';
while ($octet) {
$bin .= \chr(0x80 | ($octet & 0x7f));
$octet >>= 7;
}
$bin[0] = $bin[0] & \chr(0x7f);
// Convert to big endian if necessary
if (pack('V', 65534) == pack('L', 65534)) {
$oid .= strrev($bin);
} else {
$oid .= $bin;
}
}
return $oid;
}
}
================================================
FILE: lib/Google/vendor/firebase/php-jwt/src/JWT.php
================================================
* @author Anant Narayanan
* @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD
* @link https://github.com/firebase/php-jwt
*/
class JWT
{
private const ASN1_INTEGER = 0x02;
private const ASN1_SEQUENCE = 0x10;
private const ASN1_BIT_STRING = 0x03;
private const RSA_KEY_MIN_LENGTH=2048;
/**
* When checking nbf, iat or expiration times,
* we want to provide some extra leeway time to
* account for clock skew.
*
* @var int
*/
public static $leeway = 0;
/**
* Allow the current timestamp to be specified.
* Useful for fixing a value within unit testing.
* Will default to PHP time() value if null.
*
* @var ?int
*/
public static $timestamp = null;
/**
* @var array
*/
public static $supported_algs = [
'ES384' => ['openssl', 'SHA384'],
'ES256' => ['openssl', 'SHA256'],
'ES256K' => ['openssl', 'SHA256'],
'HS256' => ['hash_hmac', 'SHA256'],
'HS384' => ['hash_hmac', 'SHA384'],
'HS512' => ['hash_hmac', 'SHA512'],
'RS256' => ['openssl', 'SHA256'],
'RS384' => ['openssl', 'SHA384'],
'RS512' => ['openssl', 'SHA512'],
'EdDSA' => ['sodium_crypto', 'EdDSA'],
];
/**
* Decodes a JWT string into a PHP object.
*
* @param string $jwt The JWT
* @param Key|ArrayAccess|array $keyOrKeyArray The Key or associative array of key IDs
* (kid) to Key objects.
* If the algorithm used is asymmetric, this is
* the public key.
* Each Key object contains an algorithm and
* matching key.
* Supported algorithms are 'ES384','ES256',
* 'HS256', 'HS384', 'HS512', 'RS256', 'RS384'
* and 'RS512'.
* @param stdClass $headers Optional. Populates stdClass with headers.
*
* @return stdClass The JWT's payload as a PHP object
*
* @throws InvalidArgumentException Provided key/key-array was empty or malformed
* @throws DomainException Provided JWT is malformed
* @throws UnexpectedValueException Provided JWT was invalid
* @throws SignatureInvalidException Provided JWT was invalid because the signature verification failed
* @throws BeforeValidException Provided JWT is trying to be used before it's eligible as defined by 'nbf'
* @throws BeforeValidException Provided JWT is trying to be used before it's been created as defined by 'iat'
* @throws ExpiredException Provided JWT has since expired, as defined by the 'exp' claim
*
* @uses jsonDecode
* @uses urlsafeB64Decode
*/
public static function decode(
string $jwt,
#[\SensitiveParameter] $keyOrKeyArray,
?stdClass &$headers = null
): stdClass {
// Validate JWT
$timestamp = \is_null(static::$timestamp) ? \time() : static::$timestamp;
if (empty($keyOrKeyArray)) {
throw new InvalidArgumentException('Key may not be empty');
}
$tks = \explode('.', $jwt);
if (\count($tks) !== 3) {
throw new UnexpectedValueException('Wrong number of segments');
}
list($headb64, $bodyb64, $cryptob64) = $tks;
$headerRaw = static::urlsafeB64Decode($headb64);
if (null === ($header = static::jsonDecode($headerRaw))) {
throw new UnexpectedValueException('Invalid header encoding');
}
if ($headers !== null) {
$headers = $header;
}
$payloadRaw = static::urlsafeB64Decode($bodyb64);
if (null === ($payload = static::jsonDecode($payloadRaw))) {
throw new UnexpectedValueException('Invalid claims encoding');
}
if (\is_array($payload)) {
// prevent PHP Fatal Error in edge-cases when payload is empty array
$payload = (object) $payload;
}
if (!$payload instanceof stdClass) {
throw new UnexpectedValueException('Payload must be a JSON object');
}
if (isset($payload->iat) && !\is_numeric($payload->iat)) {
throw new UnexpectedValueException('Payload iat must be a number');
}
if (isset($payload->nbf) && !\is_numeric($payload->nbf)) {
throw new UnexpectedValueException('Payload nbf must be a number');
}
if (isset($payload->exp) && !\is_numeric($payload->exp)) {
throw new UnexpectedValueException('Payload exp must be a number');
}
$sig = static::urlsafeB64Decode($cryptob64);
if (empty($header->alg)) {
throw new UnexpectedValueException('Empty algorithm');
}
if (empty(static::$supported_algs[$header->alg])) {
throw new UnexpectedValueException('Algorithm not supported');
}
$key = self::getKey($keyOrKeyArray, property_exists($header, 'kid') ? $header->kid : null);
// Check the algorithm
if (!self::constantTimeEquals($key->getAlgorithm(), $header->alg)) {
// See issue #351
throw new UnexpectedValueException('Incorrect key for this algorithm');
}
if (\in_array($header->alg, ['ES256', 'ES256K', 'ES384'], true)) {
// OpenSSL expects an ASN.1 DER sequence for ES256/ES256K/ES384 signatures
$sig = self::signatureToDER($sig);
}
if (!self::verify("{$headb64}.{$bodyb64}", $sig, $key->getKeyMaterial(), $header->alg)) {
throw new SignatureInvalidException('Signature verification failed');
}
// Check the nbf if it is defined. This is the time that the
// token can actually be used. If it's not yet that time, abort.
if (isset($payload->nbf) && floor($payload->nbf) > ($timestamp + static::$leeway)) {
$ex = new BeforeValidException(
'Cannot handle token with nbf prior to ' . \date(DateTime::ATOM, (int) floor($payload->nbf))
);
$ex->setPayload($payload);
throw $ex;
}
// Check that this token has been created before 'now'. This prevents
// using tokens that have been created for later use (and haven't
// correctly used the nbf claim).
if (!isset($payload->nbf) && isset($payload->iat) && floor($payload->iat) > ($timestamp + static::$leeway)) {
$ex = new BeforeValidException(
'Cannot handle token with iat prior to ' . \date(DateTime::ATOM, (int) floor($payload->iat))
);
$ex->setPayload($payload);
throw $ex;
}
// Check if this token has expired.
if (isset($payload->exp) && ($timestamp - static::$leeway) >= $payload->exp) {
$ex = new ExpiredException('Expired token');
$ex->setPayload($payload);
$ex->setTimestamp($timestamp);
throw $ex;
}
return $payload;
}
/**
* Converts and signs a PHP array into a JWT string.
*
* @param array $payload PHP array
* @param string|OpenSSLAsymmetricKey|OpenSSLCertificate $key The secret key.
* @param string $alg Supported algorithms are 'ES384','ES256', 'ES256K', 'HS256',
* 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512'
* @param string $keyId
* @param array $head An array with header elements to attach
*
* @return string A signed JWT
*
* @uses jsonEncode
* @uses urlsafeB64Encode
*/
public static function encode(
array $payload,
#[\SensitiveParameter] $key,
string $alg,
?string $keyId = null,
?array $head = null
): string {
$header = ['typ' => 'JWT'];
if (isset($head)) {
$header = \array_merge($header, $head);
}
$header['alg'] = $alg;
if ($keyId !== null) {
$header['kid'] = $keyId;
}
$segments = [];
$segments[] = static::urlsafeB64Encode((string) static::jsonEncode($header));
$segments[] = static::urlsafeB64Encode((string) static::jsonEncode($payload));
$signing_input = \implode('.', $segments);
$signature = static::sign($signing_input, $key, $alg);
$segments[] = static::urlsafeB64Encode($signature);
return \implode('.', $segments);
}
/**
* Sign a string with a given key and algorithm.
*
* @param string $msg The message to sign
* @param string|OpenSSLAsymmetricKey|OpenSSLCertificate $key The secret key.
* @param string $alg Supported algorithms are 'EdDSA', 'ES384', 'ES256', 'ES256K', 'HS256',
* 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512'
*
* @return string An encrypted message
*
* @throws DomainException Unsupported algorithm or bad key was specified
*/
public static function sign(
string $msg,
#[\SensitiveParameter] $key,
string $alg
): string {
if (empty(static::$supported_algs[$alg])) {
throw new DomainException('Algorithm not supported');
}
list($function, $algorithm) = static::$supported_algs[$alg];
switch ($function) {
case 'hash_hmac':
if (!\is_string($key)) {
throw new InvalidArgumentException('key must be a string when using hmac');
}
self::validateHmacKeyLength($key, $algorithm);
return \hash_hmac($algorithm, $msg, $key, true);
case 'openssl':
$signature = '';
if (!$key = openssl_pkey_get_private($key)) {
throw new DomainException('OpenSSL unable to validate key');
}
if (str_starts_with($alg, 'RS')) {
self::validateRsaKeyLength($key);
} elseif (str_starts_with($alg, 'ES')) {
self::validateEcKeyLength($key, $alg);
}
$success = \openssl_sign($msg, $signature, $key, $algorithm);
if (!$success) {
throw new DomainException('OpenSSL unable to sign data');
}
if ($alg === 'ES256' || $alg === 'ES256K') {
$signature = self::signatureFromDER($signature, 256);
} elseif ($alg === 'ES384') {
$signature = self::signatureFromDER($signature, 384);
}
return $signature;
case 'sodium_crypto':
if (!\function_exists('sodium_crypto_sign_detached')) {
throw new DomainException('libsodium is not available');
}
if (!\is_string($key)) {
throw new InvalidArgumentException('key must be a string when using EdDSA');
}
try {
// The last non-empty line is used as the key.
$lines = array_filter(explode("\n", $key));
$key = base64_decode((string) end($lines));
if (\strlen($key) === 0) {
throw new DomainException('Key cannot be empty string');
}
return sodium_crypto_sign_detached($msg, $key);
} catch (Exception $e) {
throw new DomainException($e->getMessage(), 0, $e);
}
}
throw new DomainException('Algorithm not supported');
}
/**
* Verify a signature with the message, key and method. Not all methods
* are symmetric, so we must have a separate verify and sign method.
*
* @param string $msg The original message (header and body)
* @param string $signature The original signature
* @param string|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial For Ed*, ES*, HS*, a string key works. for RS*, must be an instance of OpenSSLAsymmetricKey
* @param string $alg The algorithm
*
* @return bool
*
* @throws DomainException Invalid Algorithm, bad key, or OpenSSL failure
*/
private static function verify(
string $msg,
string $signature,
#[\SensitiveParameter] $keyMaterial,
string $alg
): bool {
if (empty(static::$supported_algs[$alg])) {
throw new DomainException('Algorithm not supported');
}
list($function, $algorithm) = static::$supported_algs[$alg];
switch ($function) {
case 'openssl':
if (!$key = openssl_pkey_get_public($keyMaterial)) {
throw new DomainException('OpenSSL unable to validate key');
}
if (str_starts_with($alg, 'RS')) {
self::validateRsaKeyLength($key);
} elseif (str_starts_with($alg, 'ES')) {
self::validateEcKeyLength($key, $alg);
}
$success = \openssl_verify($msg, $signature, $keyMaterial, $algorithm);
if ($success === 1) {
return true;
}
if ($success === 0) {
return false;
}
// returns 1 on success, 0 on failure, -1 on error.
throw new DomainException(
'OpenSSL error: ' . \openssl_error_string()
);
case 'sodium_crypto':
if (!\function_exists('sodium_crypto_sign_verify_detached')) {
throw new DomainException('libsodium is not available');
}
if (!\is_string($keyMaterial)) {
throw new InvalidArgumentException('key must be a string when using EdDSA');
}
try {
// The last non-empty line is used as the key.
$lines = array_filter(explode("\n", $keyMaterial));
$key = base64_decode((string) end($lines));
if (\strlen($key) === 0) {
throw new DomainException('Key cannot be empty string');
}
if (\strlen($signature) === 0) {
throw new DomainException('Signature cannot be empty string');
}
return sodium_crypto_sign_verify_detached($signature, $msg, $key);
} catch (Exception $e) {
throw new DomainException($e->getMessage(), 0, $e);
}
case 'hash_hmac':
default:
if (!\is_string($keyMaterial)) {
throw new InvalidArgumentException('key must be a string when using hmac');
}
self::validateHmacKeyLength($keyMaterial, $algorithm);
$hash = \hash_hmac($algorithm, $msg, $keyMaterial, true);
return self::constantTimeEquals($hash, $signature);
}
}
/**
* Decode a JSON string into a PHP object.
*
* @param string $input JSON string
*
* @return mixed The decoded JSON string
*
* @throws DomainException Provided string was invalid JSON
*/
public static function jsonDecode(string $input)
{
$obj = \json_decode($input, false, 512, JSON_BIGINT_AS_STRING);
if ($errno = \json_last_error()) {
self::handleJsonError($errno);
} elseif ($obj === null && $input !== 'null') {
throw new DomainException('Null result with non-null input');
}
return $obj;
}
/**
* Encode a PHP array into a JSON string.
*
* @param array $input A PHP array
*
* @return string JSON representation of the PHP array
*
* @throws DomainException Provided object could not be encoded to valid JSON
*/
public static function jsonEncode(array $input): string
{
$json = \json_encode($input, \JSON_UNESCAPED_SLASHES);
if ($errno = \json_last_error()) {
self::handleJsonError($errno);
} elseif ($json === 'null') {
throw new DomainException('Null result with non-null input');
}
if ($json === false) {
throw new DomainException('Provided object could not be encoded to valid JSON');
}
return $json;
}
/**
* Decode a string with URL-safe Base64.
*
* @param string $input A Base64 encoded string
*
* @return string A decoded string
*
* @throws InvalidArgumentException invalid base64 characters
*/
public static function urlsafeB64Decode(string $input): string
{
return \base64_decode(self::convertBase64UrlToBase64($input));
}
/**
* Convert a string in the base64url (URL-safe Base64) encoding to standard base64.
*
* @param string $input A Base64 encoded string with URL-safe characters (-_ and no padding)
*
* @return string A Base64 encoded string with standard characters (+/) and padding (=), when
* needed.
*
* @see https://www.rfc-editor.org/rfc/rfc4648
*/
public static function convertBase64UrlToBase64(string $input): string
{
$remainder = \strlen($input) % 4;
if ($remainder) {
$padlen = 4 - $remainder;
$input .= \str_repeat('=', $padlen);
}
return \strtr($input, '-_', '+/');
}
/**
* Encode a string with URL-safe Base64.
*
* @param string $input The string you want encoded
*
* @return string The base64 encode of what you passed in
*/
public static function urlsafeB64Encode(string $input): string
{
return \str_replace('=', '', \strtr(\base64_encode($input), '+/', '-_'));
}
/**
* Determine if an algorithm has been provided for each Key
*
* @param Key|ArrayAccess|array $keyOrKeyArray
* @param string|null $kid
*
* @throws UnexpectedValueException
*
* @return Key
*/
private static function getKey(
#[\SensitiveParameter] $keyOrKeyArray,
?string $kid
): Key {
if ($keyOrKeyArray instanceof Key) {
return $keyOrKeyArray;
}
if (empty($kid) && $kid !== '0') {
throw new UnexpectedValueException('"kid" empty, unable to lookup correct key');
}
if ($keyOrKeyArray instanceof CachedKeySet) {
// Skip "isset" check, as this will automatically refresh if not set
return $keyOrKeyArray[$kid];
}
if (!isset($keyOrKeyArray[$kid])) {
throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key');
}
return $keyOrKeyArray[$kid];
}
/**
* @param string $left The string of known length to compare against
* @param string $right The user-supplied string
* @return bool
*/
public static function constantTimeEquals(string $left, string $right): bool
{
if (\function_exists('hash_equals')) {
return \hash_equals($left, $right);
}
$len = \min(self::safeStrlen($left), self::safeStrlen($right));
$status = 0;
for ($i = 0; $i < $len; $i++) {
$status |= (\ord($left[$i]) ^ \ord($right[$i]));
}
$status |= (self::safeStrlen($left) ^ self::safeStrlen($right));
return ($status === 0);
}
/**
* Helper method to create a JSON error.
*
* @param int $errno An error number from json_last_error()
*
* @throws DomainException
*
* @return void
*/
private static function handleJsonError(int $errno): void
{
$messages = [
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters' //PHP >= 5.3.3
];
throw new DomainException(
isset($messages[$errno])
? $messages[$errno]
: 'Unknown JSON error: ' . $errno
);
}
/**
* Get the number of bytes in cryptographic strings.
*
* @param string $str
*
* @return int
*/
private static function safeStrlen(string $str): int
{
if (\function_exists('mb_strlen')) {
return \mb_strlen($str, '8bit');
}
return \strlen($str);
}
/**
* Convert an ECDSA signature to an ASN.1 DER sequence
*
* @param string $sig The ECDSA signature to convert
* @return string The encoded DER object
*/
private static function signatureToDER(string $sig): string
{
// Separate the signature into r-value and s-value
$length = max(1, (int) (\strlen($sig) / 2));
list($r, $s) = \str_split($sig, $length);
// Trim leading zeros
$r = \ltrim($r, "\x00");
$s = \ltrim($s, "\x00");
// Convert r-value and s-value from unsigned big-endian integers to
// signed two's complement
if (\ord($r[0]) > 0x7f) {
$r = "\x00" . $r;
}
if (\ord($s[0]) > 0x7f) {
$s = "\x00" . $s;
}
return self::encodeDER(
self::ASN1_SEQUENCE,
self::encodeDER(self::ASN1_INTEGER, $r) .
self::encodeDER(self::ASN1_INTEGER, $s)
);
}
/**
* Encodes a value into a DER object.
*
* @param int $type DER tag
* @param string $value the value to encode
*
* @return string the encoded object
*/
private static function encodeDER(int $type, string $value): string
{
$tag_header = 0;
if ($type === self::ASN1_SEQUENCE) {
$tag_header |= 0x20;
}
// Type
$der = \chr($tag_header | $type);
// Length
$der .= \chr(\strlen($value));
return $der . $value;
}
/**
* Encodes signature from a DER object.
*
* @param string $der binary signature in DER format
* @param int $keySize the number of bits in the key
*
* @return string the signature
*/
private static function signatureFromDER(string $der, int $keySize): string
{
// OpenSSL returns the ECDSA signatures as a binary ASN.1 DER SEQUENCE
list($offset, $_) = self::readDER($der);
list($offset, $r) = self::readDER($der, $offset);
list($offset, $s) = self::readDER($der, $offset);
// Convert r-value and s-value from signed two's compliment to unsigned
// big-endian integers
$r = \ltrim($r, "\x00");
$s = \ltrim($s, "\x00");
// Pad out r and s so that they are $keySize bits long
$r = \str_pad($r, $keySize / 8, "\x00", STR_PAD_LEFT);
$s = \str_pad($s, $keySize / 8, "\x00", STR_PAD_LEFT);
return $r . $s;
}
/**
* Reads binary DER-encoded data and decodes into a single object
*
* @param string $der the binary data in DER format
* @param int $offset the offset of the data stream containing the object
* to decode
*
* @return array{int, string|null} the new offset and the decoded object
*/
private static function readDER(string $der, int $offset = 0): array
{
$pos = $offset;
$size = \strlen($der);
$constructed = (\ord($der[$pos]) >> 5) & 0x01;
$type = \ord($der[$pos++]) & 0x1f;
// Length
$len = \ord($der[$pos++]);
if ($len & 0x80) {
$n = $len & 0x1f;
$len = 0;
while ($n-- && $pos < $size) {
$len = ($len << 8) | \ord($der[$pos++]);
}
}
// Value
if ($type === self::ASN1_BIT_STRING) {
$pos++; // Skip the first contents octet (padding indicator)
$data = \substr($der, $pos, $len - 1);
$pos += $len - 1;
} elseif (!$constructed) {
$data = \substr($der, $pos, $len);
$pos += $len;
} else {
$data = null;
}
return [$pos, $data];
}
/**
* Validate HMAC key length
*
* @param string $key HMAC key material
* @param string $algorithm The algorithm
*
* @throws DomainException Provided key is too short
*/
private static function validateHmacKeyLength(string $key, string $algorithm): void
{
$keyLength = \strlen($key) * 8;
$minKeyLength = (int) \str_replace('SHA', '', $algorithm);
if ($keyLength < $minKeyLength) {
throw new DomainException('Provided key is too short');
}
}
/**
* Validate RSA key length
*
* @param OpenSSLAsymmetricKey $key RSA key material
* @throws DomainException Provided key is too short
*/
private static function validateRsaKeyLength(#[\SensitiveParameter] OpenSSLAsymmetricKey $key): void
{
if (!$keyDetails = openssl_pkey_get_details($key)) {
throw new DomainException('Unable to validate key');
}
if ($keyDetails['bits'] < self::RSA_KEY_MIN_LENGTH) {
throw new DomainException('Provided key is too short');
}
}
/**
* Validate RSA key length
*
* @param OpenSSLAsymmetricKey $key RSA key material
* @param string $algorithm The algorithm
* @throws DomainException Provided key is too short
*/
private static function validateEcKeyLength(
#[\SensitiveParameter] OpenSSLAsymmetricKey $key,
string $algorithm
): void {
if (!$keyDetails = openssl_pkey_get_details($key)) {
throw new DomainException('Unable to validate key');
}
$minKeyLength = (int) \str_replace('ES', '', $algorithm);
if ($keyDetails['bits'] < $minKeyLength) {
throw new DomainException('Provided key is too short');
}
}
}
================================================
FILE: lib/Google/vendor/firebase/php-jwt/src/JWTExceptionWithPayloadInterface.php
================================================
algorithm;
}
/**
* @return string|OpenSSLAsymmetricKey|OpenSSLCertificate
*/
public function getKeyMaterial()
{
return $this->keyMaterial;
}
}
================================================
FILE: lib/Google/vendor/firebase/php-jwt/src/SignatureInvalidException.php
================================================
'Google_Client',
'Google\\Service' => 'Google_Service',
'Google\\Service\\Resource' => 'Google_Service_Resource',
'Google\\Model' => 'Google_Model',
'Google\\Collection' => 'Google_Collection',
];
foreach ($servicesClassMap as $alias => $class) {
class_alias($class, $alias);
}
}
}
spl_autoload_register(function ($class) {
if (0 === strpos($class, 'Google_Service_')) {
// Autoload the new class, which will also create an alias for the
// old class by changing underscores to namespaces:
// Google_Service_Speech_Resource_Operations
// => Google\Service\Speech\Resource\Operations
$classExists = class_exists($newClass = str_replace('_', '\\', $class));
if ($classExists) {
return true;
}
}
}, true, true);
================================================
FILE: lib/Google/vendor/google/apiclient-services/composer.json
================================================
{
"name": "google/apiclient-services",
"type": "library",
"description": "Client library for Google APIs",
"keywords": ["google"],
"homepage": "http://developers.google.com/api-client-library/php",
"license": "Apache-2.0",
"require": {
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": {
"Google\\Service\\": "src"
},
"files": [
"autoload.php"
]
},
"autoload-dev": {
"psr-4": {
"Google\\": "tests/mocks"
}
}
}
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/AdvanceRelocateBucketOperationRequest.php
================================================
expireTime = $expireTime;
}
/**
* @return string
*/
public function getExpireTime()
{
return $this->expireTime;
}
/**
* Specifies the duration after which the relocation will revert to the sync
* stage if the relocation hasn't succeeded. Optional, if not supplied, a
* default value of 12h will be used.
*
* @param string $ttl
*/
public function setTtl($ttl)
{
$this->ttl = $ttl;
}
/**
* @return string
*/
public function getTtl()
{
return $this->ttl;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AdvanceRelocateBucketOperationRequest::class, 'Google_Service_Storage_AdvanceRelocateBucketOperationRequest');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/AnywhereCache.php
================================================
admissionPolicy = $admissionPolicy;
}
/**
* @return string
*/
public function getAdmissionPolicy()
{
return $this->admissionPolicy;
}
/**
* The ID of the Anywhere cache instance.
*
* @param string $anywhereCacheId
*/
public function setAnywhereCacheId($anywhereCacheId)
{
$this->anywhereCacheId = $anywhereCacheId;
}
/**
* @return string
*/
public function getAnywhereCacheId()
{
return $this->anywhereCacheId;
}
/**
* The name of the bucket containing this cache instance.
*
* @param string $bucket
*/
public function setBucket($bucket)
{
$this->bucket = $bucket;
}
/**
* @return string
*/
public function getBucket()
{
return $this->bucket;
}
/**
* The creation time of the cache instance in RFC 3339 format.
*
* @param string $createTime
*/
public function setCreateTime($createTime)
{
$this->createTime = $createTime;
}
/**
* @return string
*/
public function getCreateTime()
{
return $this->createTime;
}
/**
* The ID of the resource, including the project number, bucket name and
* anywhere cache ID.
*
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The kind of item this is. For Anywhere Cache, this is always
* storage#anywhereCache.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* True if the cache instance has an active Update long-running operation.
*
* @param bool $pendingUpdate
*/
public function setPendingUpdate($pendingUpdate)
{
$this->pendingUpdate = $pendingUpdate;
}
/**
* @return bool
*/
public function getPendingUpdate()
{
return $this->pendingUpdate;
}
/**
* The link to this cache instance.
*
* @param string $selfLink
*/
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
/**
* @return string
*/
public function getSelfLink()
{
return $this->selfLink;
}
/**
* The current state of the cache instance.
*
* @param string $state
*/
public function setState($state)
{
$this->state = $state;
}
/**
* @return string
*/
public function getState()
{
return $this->state;
}
/**
* The TTL of all cache entries in whole seconds. e.g., "7200s".
*
* @param string $ttl
*/
public function setTtl($ttl)
{
$this->ttl = $ttl;
}
/**
* @return string
*/
public function getTtl()
{
return $this->ttl;
}
/**
* The modification time of the cache instance metadata in RFC 3339 format.
*
* @param string $updateTime
*/
public function setUpdateTime($updateTime)
{
$this->updateTime = $updateTime;
}
/**
* @return string
*/
public function getUpdateTime()
{
return $this->updateTime;
}
/**
* The zone in which the cache instance is running. For example, us-
* central1-a.
*
* @param string $zone
*/
public function setZone($zone)
{
$this->zone = $zone;
}
/**
* @return string
*/
public function getZone()
{
return $this->zone;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AnywhereCache::class, 'Google_Service_Storage_AnywhereCache');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/AnywhereCaches.php
================================================
items = $items;
}
/**
* @return AnywhereCache[]
*/
public function getItems()
{
return $this->items;
}
/**
* The kind of item this is. For lists of Anywhere Caches, this is always
* storage#anywhereCaches.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The continuation token, used to page through large result sets. Provide
* this value in a subsequent request to return the next page of results.
*
* @param string $nextPageToken
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AnywhereCaches::class, 'Google_Service_Storage_AnywhereCaches');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Bucket.php
================================================
acl = $acl;
}
/**
* @return BucketAccessControl[]
*/
public function getAcl()
{
return $this->acl;
}
/**
* The bucket's Autoclass configuration.
*
* @param BucketAutoclass $autoclass
*/
public function setAutoclass(BucketAutoclass $autoclass)
{
$this->autoclass = $autoclass;
}
/**
* @return BucketAutoclass
*/
public function getAutoclass()
{
return $this->autoclass;
}
/**
* The bucket's billing configuration.
*
* @param BucketBilling $billing
*/
public function setBilling(BucketBilling $billing)
{
$this->billing = $billing;
}
/**
* @return BucketBilling
*/
public function getBilling()
{
return $this->billing;
}
/**
* The bucket's Cross-Origin Resource Sharing (CORS) configuration.
*
* @param BucketCors[] $cors
*/
public function setCors($cors)
{
$this->cors = $cors;
}
/**
* @return BucketCors[]
*/
public function getCors()
{
return $this->cors;
}
/**
* The bucket's custom placement configuration for Custom Dual Regions.
*
* @param BucketCustomPlacementConfig $customPlacementConfig
*/
public function setCustomPlacementConfig(BucketCustomPlacementConfig $customPlacementConfig)
{
$this->customPlacementConfig = $customPlacementConfig;
}
/**
* @return BucketCustomPlacementConfig
*/
public function getCustomPlacementConfig()
{
return $this->customPlacementConfig;
}
/**
* The default value for event-based hold on newly created objects in this
* bucket. Event-based hold is a way to retain objects indefinitely until an
* event occurs, signified by the hold's release. After being released, such
* objects will be subject to bucket-level retention (if any). One sample use
* case of this flag is for banks to hold loan documents for at least 3 years
* after loan is paid in full. Here, bucket-level retention is 3 years and the
* event is loan being paid in full. In this example, these objects will be
* held intact for any number of years until the event has occurred (event-
* based hold on the object is released) and then 3 more years after that.
* That means retention duration of the objects begins from the moment event-
* based hold transitioned from true to false. Objects under event-based hold
* cannot be deleted, overwritten or archived until the hold is removed.
*
* @param bool $defaultEventBasedHold
*/
public function setDefaultEventBasedHold($defaultEventBasedHold)
{
$this->defaultEventBasedHold = $defaultEventBasedHold;
}
/**
* @return bool
*/
public function getDefaultEventBasedHold()
{
return $this->defaultEventBasedHold;
}
/**
* Default access controls to apply to new objects when no ACL is provided.
*
* @param ObjectAccessControl[] $defaultObjectAcl
*/
public function setDefaultObjectAcl($defaultObjectAcl)
{
$this->defaultObjectAcl = $defaultObjectAcl;
}
/**
* @return ObjectAccessControl[]
*/
public function getDefaultObjectAcl()
{
return $this->defaultObjectAcl;
}
/**
* Encryption configuration for a bucket.
*
* @param BucketEncryption $encryption
*/
public function setEncryption(BucketEncryption $encryption)
{
$this->encryption = $encryption;
}
/**
* @return BucketEncryption
*/
public function getEncryption()
{
return $this->encryption;
}
/**
* HTTP 1.1 Entity tag for the bucket.
*
* @param string $etag
*/
public function setEtag($etag)
{
$this->etag = $etag;
}
/**
* @return string
*/
public function getEtag()
{
return $this->etag;
}
/**
* The generation of this bucket.
*
* @param string $generation
*/
public function setGeneration($generation)
{
$this->generation = $generation;
}
/**
* @return string
*/
public function getGeneration()
{
return $this->generation;
}
/**
* The hard delete time of the bucket in RFC 3339 format.
*
* @param string $hardDeleteTime
*/
public function setHardDeleteTime($hardDeleteTime)
{
$this->hardDeleteTime = $hardDeleteTime;
}
/**
* @return string
*/
public function getHardDeleteTime()
{
return $this->hardDeleteTime;
}
/**
* The bucket's hierarchical namespace configuration.
*
* @param BucketHierarchicalNamespace $hierarchicalNamespace
*/
public function setHierarchicalNamespace(BucketHierarchicalNamespace $hierarchicalNamespace)
{
$this->hierarchicalNamespace = $hierarchicalNamespace;
}
/**
* @return BucketHierarchicalNamespace
*/
public function getHierarchicalNamespace()
{
return $this->hierarchicalNamespace;
}
/**
* The bucket's IAM configuration.
*
* @param BucketIamConfiguration $iamConfiguration
*/
public function setIamConfiguration(BucketIamConfiguration $iamConfiguration)
{
$this->iamConfiguration = $iamConfiguration;
}
/**
* @return BucketIamConfiguration
*/
public function getIamConfiguration()
{
return $this->iamConfiguration;
}
/**
* The ID of the bucket. For buckets, the id and name properties are the same.
*
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The bucket's IP filter configuration. Specifies the network sources that
* are allowed to access the operations on the bucket, as well as its
* underlying objects. Only enforced when the mode is set to 'Enabled'.
*
* @param BucketIpFilter $ipFilter
*/
public function setIpFilter(BucketIpFilter $ipFilter)
{
$this->ipFilter = $ipFilter;
}
/**
* @return BucketIpFilter
*/
public function getIpFilter()
{
return $this->ipFilter;
}
/**
* The kind of item this is. For buckets, this is always storage#bucket.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* User-provided labels, in key/value pairs.
*
* @param string[] $labels
*/
public function setLabels($labels)
{
$this->labels = $labels;
}
/**
* @return string[]
*/
public function getLabels()
{
return $this->labels;
}
/**
* The bucket's lifecycle configuration. See [Lifecycle
* Management](https://cloud.google.com/storage/docs/lifecycle) for more
* information.
*
* @param BucketLifecycle $lifecycle
*/
public function setLifecycle(BucketLifecycle $lifecycle)
{
$this->lifecycle = $lifecycle;
}
/**
* @return BucketLifecycle
*/
public function getLifecycle()
{
return $this->lifecycle;
}
/**
* The location of the bucket. Object data for objects in the bucket resides
* in physical storage within this region. Defaults to US. See the
* [Developer's Guide](https://cloud.google.com/storage/docs/locations) for
* the authoritative list.
*
* @param string $location
*/
public function setLocation($location)
{
$this->location = $location;
}
/**
* @return string
*/
public function getLocation()
{
return $this->location;
}
/**
* The type of the bucket location.
*
* @param string $locationType
*/
public function setLocationType($locationType)
{
$this->locationType = $locationType;
}
/**
* @return string
*/
public function getLocationType()
{
return $this->locationType;
}
/**
* The bucket's logging configuration, which defines the destination bucket
* and optional name prefix for the current bucket's logs.
*
* @param BucketLogging $logging
*/
public function setLogging(BucketLogging $logging)
{
$this->logging = $logging;
}
/**
* @return BucketLogging
*/
public function getLogging()
{
return $this->logging;
}
/**
* The metadata generation of this bucket.
*
* @param string $metageneration
*/
public function setMetageneration($metageneration)
{
$this->metageneration = $metageneration;
}
/**
* @return string
*/
public function getMetageneration()
{
return $this->metageneration;
}
/**
* The name of the bucket.
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The bucket's object retention config.
*
* @param BucketObjectRetention $objectRetention
*/
public function setObjectRetention(BucketObjectRetention $objectRetention)
{
$this->objectRetention = $objectRetention;
}
/**
* @return BucketObjectRetention
*/
public function getObjectRetention()
{
return $this->objectRetention;
}
/**
* The owner of the bucket. This is always the project team's owner group.
*
* @param BucketOwner $owner
*/
public function setOwner(BucketOwner $owner)
{
$this->owner = $owner;
}
/**
* @return BucketOwner
*/
public function getOwner()
{
return $this->owner;
}
/**
* The project number of the project the bucket belongs to.
*
* @param string $projectNumber
*/
public function setProjectNumber($projectNumber)
{
$this->projectNumber = $projectNumber;
}
/**
* @return string
*/
public function getProjectNumber()
{
return $this->projectNumber;
}
/**
* The bucket's retention policy. The retention policy enforces a minimum
* retention time for all objects contained in the bucket, based on their
* creation time. Any attempt to overwrite or delete objects younger than the
* retention period will result in a PERMISSION_DENIED error. An unlocked
* retention policy can be modified or removed from the bucket via a
* storage.buckets.update operation. A locked retention policy cannot be
* removed or shortened in duration for the lifetime of the bucket. Attempting
* to remove or decrease period of a locked retention policy will result in a
* PERMISSION_DENIED error.
*
* @param BucketRetentionPolicy $retentionPolicy
*/
public function setRetentionPolicy(BucketRetentionPolicy $retentionPolicy)
{
$this->retentionPolicy = $retentionPolicy;
}
/**
* @return BucketRetentionPolicy
*/
public function getRetentionPolicy()
{
return $this->retentionPolicy;
}
/**
* The Recovery Point Objective (RPO) of this bucket. Set to ASYNC_TURBO to
* turn on Turbo Replication on a bucket.
*
* @param string $rpo
*/
public function setRpo($rpo)
{
$this->rpo = $rpo;
}
/**
* @return string
*/
public function getRpo()
{
return $this->rpo;
}
/**
* Reserved for future use.
*
* @param bool $satisfiesPZI
*/
public function setSatisfiesPZI($satisfiesPZI)
{
$this->satisfiesPZI = $satisfiesPZI;
}
/**
* @return bool
*/
public function getSatisfiesPZI()
{
return $this->satisfiesPZI;
}
/**
* Reserved for future use.
*
* @param bool $satisfiesPZS
*/
public function setSatisfiesPZS($satisfiesPZS)
{
$this->satisfiesPZS = $satisfiesPZS;
}
/**
* @return bool
*/
public function getSatisfiesPZS()
{
return $this->satisfiesPZS;
}
/**
* The URI of this bucket.
*
* @param string $selfLink
*/
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
/**
* @return string
*/
public function getSelfLink()
{
return $this->selfLink;
}
/**
* The bucket's soft delete policy, which defines the period of time that
* soft-deleted objects will be retained, and cannot be permanently deleted.
*
* @param BucketSoftDeletePolicy $softDeletePolicy
*/
public function setSoftDeletePolicy(BucketSoftDeletePolicy $softDeletePolicy)
{
$this->softDeletePolicy = $softDeletePolicy;
}
/**
* @return BucketSoftDeletePolicy
*/
public function getSoftDeletePolicy()
{
return $this->softDeletePolicy;
}
/**
* The soft delete time of the bucket in RFC 3339 format.
*
* @param string $softDeleteTime
*/
public function setSoftDeleteTime($softDeleteTime)
{
$this->softDeleteTime = $softDeleteTime;
}
/**
* @return string
*/
public function getSoftDeleteTime()
{
return $this->softDeleteTime;
}
/**
* The bucket's default storage class, used whenever no storageClass is
* specified for a newly-created object. This defines how objects in the
* bucket are stored and determines the SLA and the cost of storage. Values
* include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE,
* and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the
* bucket is created, it will default to STANDARD. For more information, see
* [Storage Classes](https://cloud.google.com/storage/docs/storage-classes).
*
* @param string $storageClass
*/
public function setStorageClass($storageClass)
{
$this->storageClass = $storageClass;
}
/**
* @return string
*/
public function getStorageClass()
{
return $this->storageClass;
}
/**
* The creation time of the bucket in RFC 3339 format.
*
* @param string $timeCreated
*/
public function setTimeCreated($timeCreated)
{
$this->timeCreated = $timeCreated;
}
/**
* @return string
*/
public function getTimeCreated()
{
return $this->timeCreated;
}
/**
* The modification time of the bucket in RFC 3339 format.
*
* @param string $updated
*/
public function setUpdated($updated)
{
$this->updated = $updated;
}
/**
* @return string
*/
public function getUpdated()
{
return $this->updated;
}
/**
* The bucket's versioning configuration.
*
* @param BucketVersioning $versioning
*/
public function setVersioning(BucketVersioning $versioning)
{
$this->versioning = $versioning;
}
/**
* @return BucketVersioning
*/
public function getVersioning()
{
return $this->versioning;
}
/**
* The bucket's website configuration, controlling how the service behaves
* when accessing bucket contents as a web site. See the [Static Website
* Examples](https://cloud.google.com/storage/docs/static-website) for more
* information.
*
* @param BucketWebsite $website
*/
public function setWebsite(BucketWebsite $website)
{
$this->website = $website;
}
/**
* @return BucketWebsite
*/
public function getWebsite()
{
return $this->website;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Bucket::class, 'Google_Service_Storage_Bucket');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketAccessControl.php
================================================
bucket = $bucket;
}
/**
* @return string
*/
public function getBucket()
{
return $this->bucket;
}
/**
* The domain associated with the entity, if any.
*
* @param string $domain
*/
public function setDomain($domain)
{
$this->domain = $domain;
}
/**
* @return string
*/
public function getDomain()
{
return $this->domain;
}
/**
* The email address associated with the entity, if any.
*
* @param string $email
*/
public function setEmail($email)
{
$this->email = $email;
}
/**
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* The entity holding the permission, in one of the following forms: - user-
* userId - user-email - group-groupId - group-email - domain-domain -
* project-team-projectId - allUsers - allAuthenticatedUsers Examples: -
* The user liz@example.com would be user-liz@example.com. - The group
* example@googlegroups.com would be group-example@googlegroups.com. - To
* refer to all members of the Google Apps for Business domain example.com,
* the entity would be domain-example.com.
*
* @param string $entity
*/
public function setEntity($entity)
{
$this->entity = $entity;
}
/**
* @return string
*/
public function getEntity()
{
return $this->entity;
}
/**
* The ID for the entity, if any.
*
* @param string $entityId
*/
public function setEntityId($entityId)
{
$this->entityId = $entityId;
}
/**
* @return string
*/
public function getEntityId()
{
return $this->entityId;
}
/**
* HTTP 1.1 Entity tag for the access-control entry.
*
* @param string $etag
*/
public function setEtag($etag)
{
$this->etag = $etag;
}
/**
* @return string
*/
public function getEtag()
{
return $this->etag;
}
/**
* The ID of the access-control entry.
*
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The kind of item this is. For bucket access control entries, this is always
* storage#bucketAccessControl.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The project team associated with the entity, if any.
*
* @param BucketAccessControlProjectTeam $projectTeam
*/
public function setProjectTeam(BucketAccessControlProjectTeam $projectTeam)
{
$this->projectTeam = $projectTeam;
}
/**
* @return BucketAccessControlProjectTeam
*/
public function getProjectTeam()
{
return $this->projectTeam;
}
/**
* The access permission for the entity.
*
* @param string $role
*/
public function setRole($role)
{
$this->role = $role;
}
/**
* @return string
*/
public function getRole()
{
return $this->role;
}
/**
* The link to this access-control entry.
*
* @param string $selfLink
*/
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
/**
* @return string
*/
public function getSelfLink()
{
return $this->selfLink;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketAccessControl::class, 'Google_Service_Storage_BucketAccessControl');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketAccessControlProjectTeam.php
================================================
projectNumber = $projectNumber;
}
/**
* @return string
*/
public function getProjectNumber()
{
return $this->projectNumber;
}
/**
* The team.
*
* @param string $team
*/
public function setTeam($team)
{
$this->team = $team;
}
/**
* @return string
*/
public function getTeam()
{
return $this->team;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketAccessControlProjectTeam::class, 'Google_Service_Storage_BucketAccessControlProjectTeam');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketAccessControls.php
================================================
items = $items;
}
/**
* @return BucketAccessControl[]
*/
public function getItems()
{
return $this->items;
}
/**
* The kind of item this is. For lists of bucket access control entries, this
* is always storage#bucketAccessControls.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketAccessControls::class, 'Google_Service_Storage_BucketAccessControls');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketAutoclass.php
================================================
enabled = $enabled;
}
/**
* @return bool
*/
public function getEnabled()
{
return $this->enabled;
}
/**
* The storage class that objects in the bucket eventually transition to if
* they are not read for a certain length of time. Valid values are NEARLINE
* and ARCHIVE.
*
* @param string $terminalStorageClass
*/
public function setTerminalStorageClass($terminalStorageClass)
{
$this->terminalStorageClass = $terminalStorageClass;
}
/**
* @return string
*/
public function getTerminalStorageClass()
{
return $this->terminalStorageClass;
}
/**
* A date and time in RFC 3339 format representing the time of the most recent
* update to "terminalStorageClass".
*
* @param string $terminalStorageClassUpdateTime
*/
public function setTerminalStorageClassUpdateTime($terminalStorageClassUpdateTime)
{
$this->terminalStorageClassUpdateTime = $terminalStorageClassUpdateTime;
}
/**
* @return string
*/
public function getTerminalStorageClassUpdateTime()
{
return $this->terminalStorageClassUpdateTime;
}
/**
* A date and time in RFC 3339 format representing the instant at which
* "enabled" was last toggled.
*
* @param string $toggleTime
*/
public function setToggleTime($toggleTime)
{
$this->toggleTime = $toggleTime;
}
/**
* @return string
*/
public function getToggleTime()
{
return $this->toggleTime;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketAutoclass::class, 'Google_Service_Storage_BucketAutoclass');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketBilling.php
================================================
requesterPays = $requesterPays;
}
/**
* @return bool
*/
public function getRequesterPays()
{
return $this->requesterPays;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketBilling::class, 'Google_Service_Storage_BucketBilling');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketCors.php
================================================
maxAgeSeconds = $maxAgeSeconds;
}
/**
* @return int
*/
public function getMaxAgeSeconds()
{
return $this->maxAgeSeconds;
}
/**
* The list of HTTP methods on which to include CORS response headers, (GET,
* OPTIONS, POST, etc) Note: "*" is permitted in the list of methods, and
* means "any method".
*
* @param string[] $method
*/
public function setMethod($method)
{
$this->method = $method;
}
/**
* @return string[]
*/
public function getMethod()
{
return $this->method;
}
/**
* The list of Origins eligible to receive CORS response headers. Note: "*" is
* permitted in the list of origins, and means "any Origin".
*
* @param string[] $origin
*/
public function setOrigin($origin)
{
$this->origin = $origin;
}
/**
* @return string[]
*/
public function getOrigin()
{
return $this->origin;
}
/**
* The list of HTTP headers other than the simple response headers to give
* permission for the user-agent to share across domains.
*
* @param string[] $responseHeader
*/
public function setResponseHeader($responseHeader)
{
$this->responseHeader = $responseHeader;
}
/**
* @return string[]
*/
public function getResponseHeader()
{
return $this->responseHeader;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketCors::class, 'Google_Service_Storage_BucketCors');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketCustomPlacementConfig.php
================================================
dataLocations = $dataLocations;
}
/**
* @return string[]
*/
public function getDataLocations()
{
return $this->dataLocations;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketCustomPlacementConfig::class, 'Google_Service_Storage_BucketCustomPlacementConfig');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryption.php
================================================
customerManagedEncryptionEnforcementConfig = $customerManagedEncryptionEnforcementConfig;
}
/**
* @return BucketEncryptionCustomerManagedEncryptionEnforcementConfig
*/
public function getCustomerManagedEncryptionEnforcementConfig()
{
return $this->customerManagedEncryptionEnforcementConfig;
}
/**
* If set, the new objects created in this bucket must comply with this
* enforcement config. Changing this has no effect on existing objects; it
* applies to new objects only. If omitted, the new objects are allowed to be
* encrypted with Customer Supplied Encryption type by default.
*
* @param BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig $customerSuppliedEncryptionEnforcementConfig
*/
public function setCustomerSuppliedEncryptionEnforcementConfig(BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig $customerSuppliedEncryptionEnforcementConfig)
{
$this->customerSuppliedEncryptionEnforcementConfig = $customerSuppliedEncryptionEnforcementConfig;
}
/**
* @return BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig
*/
public function getCustomerSuppliedEncryptionEnforcementConfig()
{
return $this->customerSuppliedEncryptionEnforcementConfig;
}
/**
* A Cloud KMS key that will be used to encrypt objects inserted into this
* bucket, if no encryption method is specified.
*
* @param string $defaultKmsKeyName
*/
public function setDefaultKmsKeyName($defaultKmsKeyName)
{
$this->defaultKmsKeyName = $defaultKmsKeyName;
}
/**
* @return string
*/
public function getDefaultKmsKeyName()
{
return $this->defaultKmsKeyName;
}
/**
* If set, the new objects created in this bucket must comply with this
* enforcement config. Changing this has no effect on existing objects; it
* applies to new objects only. If omitted, the new objects are allowed to be
* encrypted with Google Managed Encryption type by default.
*
* @param BucketEncryptionGoogleManagedEncryptionEnforcementConfig $googleManagedEncryptionEnforcementConfig
*/
public function setGoogleManagedEncryptionEnforcementConfig(BucketEncryptionGoogleManagedEncryptionEnforcementConfig $googleManagedEncryptionEnforcementConfig)
{
$this->googleManagedEncryptionEnforcementConfig = $googleManagedEncryptionEnforcementConfig;
}
/**
* @return BucketEncryptionGoogleManagedEncryptionEnforcementConfig
*/
public function getGoogleManagedEncryptionEnforcementConfig()
{
return $this->googleManagedEncryptionEnforcementConfig;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketEncryption::class, 'Google_Service_Storage_BucketEncryption');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerManagedEncryptionEnforcementConfig.php
================================================
effectiveTime = $effectiveTime;
}
/**
* @return string
*/
public function getEffectiveTime()
{
return $this->effectiveTime;
}
/**
* Restriction mode for Customer-Managed Encryption Keys. Defaults to
* NotRestricted.
*
* Accepted values: NotRestricted, FullyRestricted
*
* @param self::RESTRICTION_MODE_* $restrictionMode
*/
public function setRestrictionMode($restrictionMode)
{
$this->restrictionMode = $restrictionMode;
}
/**
* @return self::RESTRICTION_MODE_*
*/
public function getRestrictionMode()
{
return $this->restrictionMode;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketEncryptionCustomerManagedEncryptionEnforcementConfig::class, 'Google_Service_Storage_BucketEncryptionCustomerManagedEncryptionEnforcementConfig');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig.php
================================================
effectiveTime = $effectiveTime;
}
/**
* @return string
*/
public function getEffectiveTime()
{
return $this->effectiveTime;
}
/**
* Restriction mode for Customer-Supplied Encryption Keys. Defaults to
* NotRestricted.
*
* Accepted values: NotRestricted, FullyRestricted
*
* @param self::RESTRICTION_MODE_* $restrictionMode
*/
public function setRestrictionMode($restrictionMode)
{
$this->restrictionMode = $restrictionMode;
}
/**
* @return self::RESTRICTION_MODE_*
*/
public function getRestrictionMode()
{
return $this->restrictionMode;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig::class, 'Google_Service_Storage_BucketEncryptionCustomerSuppliedEncryptionEnforcementConfig');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketEncryptionGoogleManagedEncryptionEnforcementConfig.php
================================================
effectiveTime = $effectiveTime;
}
/**
* @return string
*/
public function getEffectiveTime()
{
return $this->effectiveTime;
}
/**
* Restriction mode for Google-Managed Encryption Keys. Defaults to
* NotRestricted.
*
* Accepted values: NotRestricted, FullyRestricted
*
* @param self::RESTRICTION_MODE_* $restrictionMode
*/
public function setRestrictionMode($restrictionMode)
{
$this->restrictionMode = $restrictionMode;
}
/**
* @return self::RESTRICTION_MODE_*
*/
public function getRestrictionMode()
{
return $this->restrictionMode;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketEncryptionGoogleManagedEncryptionEnforcementConfig::class, 'Google_Service_Storage_BucketEncryptionGoogleManagedEncryptionEnforcementConfig');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketHierarchicalNamespace.php
================================================
enabled = $enabled;
}
/**
* @return bool
*/
public function getEnabled()
{
return $this->enabled;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketHierarchicalNamespace::class, 'Google_Service_Storage_BucketHierarchicalNamespace');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketIamConfiguration.php
================================================
bucketPolicyOnly = $bucketPolicyOnly;
}
/**
* @return BucketIamConfigurationBucketPolicyOnly
*/
public function getBucketPolicyOnly()
{
return $this->bucketPolicyOnly;
}
/**
* The bucket's Public Access Prevention configuration. Currently, 'inherited'
* and 'enforced' are supported.
*
* @param string $publicAccessPrevention
*/
public function setPublicAccessPrevention($publicAccessPrevention)
{
$this->publicAccessPrevention = $publicAccessPrevention;
}
/**
* @return string
*/
public function getPublicAccessPrevention()
{
return $this->publicAccessPrevention;
}
/**
* The bucket's uniform bucket-level access configuration.
*
* @param BucketIamConfigurationUniformBucketLevelAccess $uniformBucketLevelAccess
*/
public function setUniformBucketLevelAccess(BucketIamConfigurationUniformBucketLevelAccess $uniformBucketLevelAccess)
{
$this->uniformBucketLevelAccess = $uniformBucketLevelAccess;
}
/**
* @return BucketIamConfigurationUniformBucketLevelAccess
*/
public function getUniformBucketLevelAccess()
{
return $this->uniformBucketLevelAccess;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketIamConfiguration::class, 'Google_Service_Storage_BucketIamConfiguration');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketIamConfigurationBucketPolicyOnly.php
================================================
enabled = $enabled;
}
/**
* @return bool
*/
public function getEnabled()
{
return $this->enabled;
}
/**
* The deadline for changing iamConfiguration.bucketPolicyOnly.enabled from
* true to false in RFC 3339 format. iamConfiguration.bucketPolicyOnly.enabled
* may be changed from true to false until the locked time, after which the
* field is immutable.
*
* @param string $lockedTime
*/
public function setLockedTime($lockedTime)
{
$this->lockedTime = $lockedTime;
}
/**
* @return string
*/
public function getLockedTime()
{
return $this->lockedTime;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketIamConfigurationBucketPolicyOnly::class, 'Google_Service_Storage_BucketIamConfigurationBucketPolicyOnly');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketIamConfigurationUniformBucketLevelAccess.php
================================================
enabled = $enabled;
}
/**
* @return bool
*/
public function getEnabled()
{
return $this->enabled;
}
/**
* The deadline for changing iamConfiguration.uniformBucketLevelAccess.enabled
* from true to false in RFC 3339 format.
* iamConfiguration.uniformBucketLevelAccess.enabled may be changed from true
* to false until the locked time, after which the field is immutable.
*
* @param string $lockedTime
*/
public function setLockedTime($lockedTime)
{
$this->lockedTime = $lockedTime;
}
/**
* @return string
*/
public function getLockedTime()
{
return $this->lockedTime;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketIamConfigurationUniformBucketLevelAccess::class, 'Google_Service_Storage_BucketIamConfigurationUniformBucketLevelAccess');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilter.php
================================================
allowAllServiceAgentAccess = $allowAllServiceAgentAccess;
}
/**
* @return bool
*/
public function getAllowAllServiceAgentAccess()
{
return $this->allowAllServiceAgentAccess;
}
/**
* Whether to allow cross-org VPCs in the bucket's IP filter configuration.
*
* @param bool $allowCrossOrgVpcs
*/
public function setAllowCrossOrgVpcs($allowCrossOrgVpcs)
{
$this->allowCrossOrgVpcs = $allowCrossOrgVpcs;
}
/**
* @return bool
*/
public function getAllowCrossOrgVpcs()
{
return $this->allowCrossOrgVpcs;
}
/**
* The mode of the IP filter. Valid values are 'Enabled' and 'Disabled'.
*
* @param string $mode
*/
public function setMode($mode)
{
$this->mode = $mode;
}
/**
* @return string
*/
public function getMode()
{
return $this->mode;
}
/**
* The public network source of the bucket's IP filter.
*
* @param BucketIpFilterPublicNetworkSource $publicNetworkSource
*/
public function setPublicNetworkSource(BucketIpFilterPublicNetworkSource $publicNetworkSource)
{
$this->publicNetworkSource = $publicNetworkSource;
}
/**
* @return BucketIpFilterPublicNetworkSource
*/
public function getPublicNetworkSource()
{
return $this->publicNetworkSource;
}
/**
* The list of [VPC network](https://cloud.google.com/vpc/docs/vpc) sources of
* the bucket's IP filter.
*
* @param BucketIpFilterVpcNetworkSources[] $vpcNetworkSources
*/
public function setVpcNetworkSources($vpcNetworkSources)
{
$this->vpcNetworkSources = $vpcNetworkSources;
}
/**
* @return BucketIpFilterVpcNetworkSources[]
*/
public function getVpcNetworkSources()
{
return $this->vpcNetworkSources;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketIpFilter::class, 'Google_Service_Storage_BucketIpFilter');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilterPublicNetworkSource.php
================================================
allowedIpCidrRanges = $allowedIpCidrRanges;
}
/**
* @return string[]
*/
public function getAllowedIpCidrRanges()
{
return $this->allowedIpCidrRanges;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketIpFilterPublicNetworkSource::class, 'Google_Service_Storage_BucketIpFilterPublicNetworkSource');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketIpFilterVpcNetworkSources.php
================================================
allowedIpCidrRanges = $allowedIpCidrRanges;
}
/**
* @return string[]
*/
public function getAllowedIpCidrRanges()
{
return $this->allowedIpCidrRanges;
}
/**
* Name of the network. Format:
* projects/{PROJECT_ID}/global/networks/{NETWORK_NAME}
*
* @param string $network
*/
public function setNetwork($network)
{
$this->network = $network;
}
/**
* @return string
*/
public function getNetwork()
{
return $this->network;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketIpFilterVpcNetworkSources::class, 'Google_Service_Storage_BucketIpFilterVpcNetworkSources');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketLifecycle.php
================================================
rule = $rule;
}
/**
* @return BucketLifecycleRule[]
*/
public function getRule()
{
return $this->rule;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketLifecycle::class, 'Google_Service_Storage_BucketLifecycle');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketLifecycleRule.php
================================================
action = $action;
}
/**
* @return BucketLifecycleRuleAction
*/
public function getAction()
{
return $this->action;
}
/**
* The condition(s) under which the action will be taken.
*
* @param BucketLifecycleRuleCondition $condition
*/
public function setCondition(BucketLifecycleRuleCondition $condition)
{
$this->condition = $condition;
}
/**
* @return BucketLifecycleRuleCondition
*/
public function getCondition()
{
return $this->condition;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketLifecycleRule::class, 'Google_Service_Storage_BucketLifecycleRule');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketLifecycleRuleAction.php
================================================
storageClass = $storageClass;
}
/**
* @return string
*/
public function getStorageClass()
{
return $this->storageClass;
}
/**
* Type of the action. Currently, only Delete, SetStorageClass, and
* AbortIncompleteMultipartUpload are supported.
*
* @param string $type
*/
public function setType($type)
{
$this->type = $type;
}
/**
* @return string
*/
public function getType()
{
return $this->type;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketLifecycleRuleAction::class, 'Google_Service_Storage_BucketLifecycleRuleAction');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketLifecycleRuleCondition.php
================================================
age = $age;
}
/**
* @return int
*/
public function getAge()
{
return $this->age;
}
/**
* A date in RFC 3339 format with only the date part (for instance,
* "2013-01-15"). This condition is satisfied when an object is created before
* midnight of the specified date in UTC.
*
* @param string $createdBefore
*/
public function setCreatedBefore($createdBefore)
{
$this->createdBefore = $createdBefore;
}
/**
* @return string
*/
public function getCreatedBefore()
{
return $this->createdBefore;
}
/**
* A date in RFC 3339 format with only the date part (for instance,
* "2013-01-15"). This condition is satisfied when the custom time on an
* object is before this date in UTC.
*
* @param string $customTimeBefore
*/
public function setCustomTimeBefore($customTimeBefore)
{
$this->customTimeBefore = $customTimeBefore;
}
/**
* @return string
*/
public function getCustomTimeBefore()
{
return $this->customTimeBefore;
}
/**
* Number of days elapsed since the user-specified timestamp set on an object.
* The condition is satisfied if the days elapsed is at least this number. If
* no custom timestamp is specified on an object, the condition does not
* apply.
*
* @param int $daysSinceCustomTime
*/
public function setDaysSinceCustomTime($daysSinceCustomTime)
{
$this->daysSinceCustomTime = $daysSinceCustomTime;
}
/**
* @return int
*/
public function getDaysSinceCustomTime()
{
return $this->daysSinceCustomTime;
}
/**
* Number of days elapsed since the noncurrent timestamp of an object. The
* condition is satisfied if the days elapsed is at least this number. This
* condition is relevant only for versioned objects. The value of the field
* must be a nonnegative integer. If it's zero, the object version will become
* eligible for Lifecycle action as soon as it becomes noncurrent.
*
* @param int $daysSinceNoncurrentTime
*/
public function setDaysSinceNoncurrentTime($daysSinceNoncurrentTime)
{
$this->daysSinceNoncurrentTime = $daysSinceNoncurrentTime;
}
/**
* @return int
*/
public function getDaysSinceNoncurrentTime()
{
return $this->daysSinceNoncurrentTime;
}
/**
* Relevant only for versioned objects. If the value is true, this condition
* matches live objects; if the value is false, it matches archived objects.
*
* @param bool $isLive
*/
public function setIsLive($isLive)
{
$this->isLive = $isLive;
}
/**
* @return bool
*/
public function getIsLive()
{
return $this->isLive;
}
/**
* A regular expression that satisfies the RE2 syntax. This condition is
* satisfied when the name of the object matches the RE2 pattern. Note: This
* feature is currently in the "Early Access" launch stage and is only
* available to a whitelisted set of users; that means that this feature may
* be changed in backward-incompatible ways and that it is not guaranteed to
* be released.
*
* @param string $matchesPattern
*/
public function setMatchesPattern($matchesPattern)
{
$this->matchesPattern = $matchesPattern;
}
/**
* @return string
*/
public function getMatchesPattern()
{
return $this->matchesPattern;
}
/**
* List of object name prefixes. This condition will be satisfied when at
* least one of the prefixes exactly matches the beginning of the object name.
*
* @param string[] $matchesPrefix
*/
public function setMatchesPrefix($matchesPrefix)
{
$this->matchesPrefix = $matchesPrefix;
}
/**
* @return string[]
*/
public function getMatchesPrefix()
{
return $this->matchesPrefix;
}
/**
* Objects having any of the storage classes specified by this condition will
* be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE,
* ARCHIVE, STANDARD, and DURABLE_REDUCED_AVAILABILITY.
*
* @param string[] $matchesStorageClass
*/
public function setMatchesStorageClass($matchesStorageClass)
{
$this->matchesStorageClass = $matchesStorageClass;
}
/**
* @return string[]
*/
public function getMatchesStorageClass()
{
return $this->matchesStorageClass;
}
/**
* List of object name suffixes. This condition will be satisfied when at
* least one of the suffixes exactly matches the end of the object name.
*
* @param string[] $matchesSuffix
*/
public function setMatchesSuffix($matchesSuffix)
{
$this->matchesSuffix = $matchesSuffix;
}
/**
* @return string[]
*/
public function getMatchesSuffix()
{
return $this->matchesSuffix;
}
/**
* A date in RFC 3339 format with only the date part (for instance,
* "2013-01-15"). This condition is satisfied when the noncurrent time on an
* object is before this date in UTC. This condition is relevant only for
* versioned objects.
*
* @param string $noncurrentTimeBefore
*/
public function setNoncurrentTimeBefore($noncurrentTimeBefore)
{
$this->noncurrentTimeBefore = $noncurrentTimeBefore;
}
/**
* @return string
*/
public function getNoncurrentTimeBefore()
{
return $this->noncurrentTimeBefore;
}
/**
* Relevant only for versioned objects. If the value is N, this condition is
* satisfied when there are at least N versions (including the live version)
* newer than this version of the object.
*
* @param int $numNewerVersions
*/
public function setNumNewerVersions($numNewerVersions)
{
$this->numNewerVersions = $numNewerVersions;
}
/**
* @return int
*/
public function getNumNewerVersions()
{
return $this->numNewerVersions;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketLifecycleRuleCondition::class, 'Google_Service_Storage_BucketLifecycleRuleCondition');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketLogging.php
================================================
logBucket = $logBucket;
}
/**
* @return string
*/
public function getLogBucket()
{
return $this->logBucket;
}
/**
* A prefix for log object names.
*
* @param string $logObjectPrefix
*/
public function setLogObjectPrefix($logObjectPrefix)
{
$this->logObjectPrefix = $logObjectPrefix;
}
/**
* @return string
*/
public function getLogObjectPrefix()
{
return $this->logObjectPrefix;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketLogging::class, 'Google_Service_Storage_BucketLogging');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketObjectRetention.php
================================================
mode = $mode;
}
/**
* @return string
*/
public function getMode()
{
return $this->mode;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketObjectRetention::class, 'Google_Service_Storage_BucketObjectRetention');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketOwner.php
================================================
entity = $entity;
}
/**
* @return string
*/
public function getEntity()
{
return $this->entity;
}
/**
* The ID for the entity.
*
* @param string $entityId
*/
public function setEntityId($entityId)
{
$this->entityId = $entityId;
}
/**
* @return string
*/
public function getEntityId()
{
return $this->entityId;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketOwner::class, 'Google_Service_Storage_BucketOwner');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketRetentionPolicy.php
================================================
effectiveTime = $effectiveTime;
}
/**
* @return string
*/
public function getEffectiveTime()
{
return $this->effectiveTime;
}
/**
* Once locked, an object retention policy cannot be modified.
*
* @param bool $isLocked
*/
public function setIsLocked($isLocked)
{
$this->isLocked = $isLocked;
}
/**
* @return bool
*/
public function getIsLocked()
{
return $this->isLocked;
}
/**
* The duration in seconds that objects need to be retained. Retention
* duration must be greater than zero and less than 100 years. Note that
* enforcement of retention periods less than a day is not guaranteed. Such
* periods should only be used for testing purposes.
*
* @param string $retentionPeriod
*/
public function setRetentionPeriod($retentionPeriod)
{
$this->retentionPeriod = $retentionPeriod;
}
/**
* @return string
*/
public function getRetentionPeriod()
{
return $this->retentionPeriod;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketRetentionPolicy::class, 'Google_Service_Storage_BucketRetentionPolicy');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketSoftDeletePolicy.php
================================================
effectiveTime = $effectiveTime;
}
/**
* @return string
*/
public function getEffectiveTime()
{
return $this->effectiveTime;
}
/**
* The duration in seconds that soft-deleted objects in the bucket will be
* retained and cannot be permanently deleted.
*
* @param string $retentionDurationSeconds
*/
public function setRetentionDurationSeconds($retentionDurationSeconds)
{
$this->retentionDurationSeconds = $retentionDurationSeconds;
}
/**
* @return string
*/
public function getRetentionDurationSeconds()
{
return $this->retentionDurationSeconds;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketSoftDeletePolicy::class, 'Google_Service_Storage_BucketSoftDeletePolicy');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketStorageLayout.php
================================================
bucket = $bucket;
}
/**
* @return string
*/
public function getBucket()
{
return $this->bucket;
}
/**
* The bucket's custom placement configuration for Custom Dual Regions.
*
* @param BucketStorageLayoutCustomPlacementConfig $customPlacementConfig
*/
public function setCustomPlacementConfig(BucketStorageLayoutCustomPlacementConfig $customPlacementConfig)
{
$this->customPlacementConfig = $customPlacementConfig;
}
/**
* @return BucketStorageLayoutCustomPlacementConfig
*/
public function getCustomPlacementConfig()
{
return $this->customPlacementConfig;
}
/**
* The bucket's hierarchical namespace configuration.
*
* @param BucketStorageLayoutHierarchicalNamespace $hierarchicalNamespace
*/
public function setHierarchicalNamespace(BucketStorageLayoutHierarchicalNamespace $hierarchicalNamespace)
{
$this->hierarchicalNamespace = $hierarchicalNamespace;
}
/**
* @return BucketStorageLayoutHierarchicalNamespace
*/
public function getHierarchicalNamespace()
{
return $this->hierarchicalNamespace;
}
/**
* The kind of item this is. For storage layout, this is always
* storage#storageLayout.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The location of the bucket.
*
* @param string $location
*/
public function setLocation($location)
{
$this->location = $location;
}
/**
* @return string
*/
public function getLocation()
{
return $this->location;
}
/**
* The type of the bucket location.
*
* @param string $locationType
*/
public function setLocationType($locationType)
{
$this->locationType = $locationType;
}
/**
* @return string
*/
public function getLocationType()
{
return $this->locationType;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketStorageLayout::class, 'Google_Service_Storage_BucketStorageLayout');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketStorageLayoutCustomPlacementConfig.php
================================================
dataLocations = $dataLocations;
}
/**
* @return string[]
*/
public function getDataLocations()
{
return $this->dataLocations;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketStorageLayoutCustomPlacementConfig::class, 'Google_Service_Storage_BucketStorageLayoutCustomPlacementConfig');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketStorageLayoutHierarchicalNamespace.php
================================================
enabled = $enabled;
}
/**
* @return bool
*/
public function getEnabled()
{
return $this->enabled;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketStorageLayoutHierarchicalNamespace::class, 'Google_Service_Storage_BucketStorageLayoutHierarchicalNamespace');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketVersioning.php
================================================
enabled = $enabled;
}
/**
* @return bool
*/
public function getEnabled()
{
return $this->enabled;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketVersioning::class, 'Google_Service_Storage_BucketVersioning');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BucketWebsite.php
================================================
mainPageSuffix = $mainPageSuffix;
}
/**
* @return string
*/
public function getMainPageSuffix()
{
return $this->mainPageSuffix;
}
/**
* If the requested object path is missing, and any mainPageSuffix object is
* missing, if applicable, the service will return the named object from this
* bucket as the content for a 404 Not Found result.
*
* @param string $notFoundPage
*/
public function setNotFoundPage($notFoundPage)
{
$this->notFoundPage = $notFoundPage;
}
/**
* @return string
*/
public function getNotFoundPage()
{
return $this->notFoundPage;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketWebsite::class, 'Google_Service_Storage_BucketWebsite');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Buckets.php
================================================
items = $items;
}
/**
* @return Bucket[]
*/
public function getItems()
{
return $this->items;
}
/**
* The kind of item this is. For lists of buckets, this is always
* storage#buckets.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The continuation token, used to page through large result sets. Provide
* this value in a subsequent request to return the next page of results.
*
* @param string $nextPageToken
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
/**
* The list of bucket resource names that could not be reached during the
* listing operation.
*
* @param string[] $unreachable
*/
public function setUnreachable($unreachable)
{
$this->unreachable = $unreachable;
}
/**
* @return string[]
*/
public function getUnreachable()
{
return $this->unreachable;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Buckets::class, 'Google_Service_Storage_Buckets');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/BulkRestoreObjectsRequest.php
================================================
allowOverwrite = $allowOverwrite;
}
/**
* @return bool
*/
public function getAllowOverwrite()
{
return $this->allowOverwrite;
}
/**
* If true, copies the source object's ACL; otherwise, uses the bucket's
* default object ACL. The default is false.
*
* @param bool $copySourceAcl
*/
public function setCopySourceAcl($copySourceAcl)
{
$this->copySourceAcl = $copySourceAcl;
}
/**
* @return bool
*/
public function getCopySourceAcl()
{
return $this->copySourceAcl;
}
/**
* Restores only the objects that were created after this time.
*
* @param string $createdAfterTime
*/
public function setCreatedAfterTime($createdAfterTime)
{
$this->createdAfterTime = $createdAfterTime;
}
/**
* @return string
*/
public function getCreatedAfterTime()
{
return $this->createdAfterTime;
}
/**
* Restores only the objects that were created before this time.
*
* @param string $createdBeforeTime
*/
public function setCreatedBeforeTime($createdBeforeTime)
{
$this->createdBeforeTime = $createdBeforeTime;
}
/**
* @return string
*/
public function getCreatedBeforeTime()
{
return $this->createdBeforeTime;
}
/**
* Restores only the objects matching any of the specified glob(s). If this
* parameter is not specified, all objects will be restored within the
* specified time range.
*
* @param string[] $matchGlobs
*/
public function setMatchGlobs($matchGlobs)
{
$this->matchGlobs = $matchGlobs;
}
/**
* @return string[]
*/
public function getMatchGlobs()
{
return $this->matchGlobs;
}
/**
* Restores only the objects that were soft-deleted after this time.
*
* @param string $softDeletedAfterTime
*/
public function setSoftDeletedAfterTime($softDeletedAfterTime)
{
$this->softDeletedAfterTime = $softDeletedAfterTime;
}
/**
* @return string
*/
public function getSoftDeletedAfterTime()
{
return $this->softDeletedAfterTime;
}
/**
* Restores only the objects that were soft-deleted before this time.
*
* @param string $softDeletedBeforeTime
*/
public function setSoftDeletedBeforeTime($softDeletedBeforeTime)
{
$this->softDeletedBeforeTime = $softDeletedBeforeTime;
}
/**
* @return string
*/
public function getSoftDeletedBeforeTime()
{
return $this->softDeletedBeforeTime;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BulkRestoreObjectsRequest::class, 'Google_Service_Storage_BulkRestoreObjectsRequest');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Channel.php
================================================
address = $address;
}
/**
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* Date and time of notification channel expiration, expressed as a Unix
* timestamp, in milliseconds. Optional.
*
* @param string $expiration
*/
public function setExpiration($expiration)
{
$this->expiration = $expiration;
}
/**
* @return string
*/
public function getExpiration()
{
return $this->expiration;
}
/**
* A UUID or similar unique string that identifies this channel.
*
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Identifies this as a notification channel used to watch for changes to a
* resource, which is "api#channel".
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* Additional parameters controlling delivery channel behavior. Optional.
*
* @param string[] $params
*/
public function setParams($params)
{
$this->params = $params;
}
/**
* @return string[]
*/
public function getParams()
{
return $this->params;
}
/**
* A Boolean value to indicate whether payload is wanted. Optional.
*
* @param bool $payload
*/
public function setPayload($payload)
{
$this->payload = $payload;
}
/**
* @return bool
*/
public function getPayload()
{
return $this->payload;
}
/**
* An opaque ID that identifies the resource being watched on this channel.
* Stable across different API versions.
*
* @param string $resourceId
*/
public function setResourceId($resourceId)
{
$this->resourceId = $resourceId;
}
/**
* @return string
*/
public function getResourceId()
{
return $this->resourceId;
}
/**
* A version-specific identifier for the watched resource.
*
* @param string $resourceUri
*/
public function setResourceUri($resourceUri)
{
$this->resourceUri = $resourceUri;
}
/**
* @return string
*/
public function getResourceUri()
{
return $this->resourceUri;
}
/**
* An arbitrary string delivered to the target address with each notification
* delivered over this channel. Optional.
*
* @param string $token
*/
public function setToken($token)
{
$this->token = $token;
}
/**
* @return string
*/
public function getToken()
{
return $this->token;
}
/**
* The type of delivery mechanism used for this channel.
*
* @param string $type
*/
public function setType($type)
{
$this->type = $type;
}
/**
* @return string
*/
public function getType()
{
return $this->type;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Channel::class, 'Google_Service_Storage_Channel');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/ComposeRequest.php
================================================
deleteSourceObjects = $deleteSourceObjects;
}
/**
* @return bool
*/
public function getDeleteSourceObjects()
{
return $this->deleteSourceObjects;
}
/**
* Properties of the resulting object.
*
* @param StorageObject $destination
*/
public function setDestination(StorageObject $destination)
{
$this->destination = $destination;
}
/**
* @return StorageObject
*/
public function getDestination()
{
return $this->destination;
}
/**
* The kind of item this is.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The list of source objects that will be concatenated into a single object.
*
* @param ComposeRequestSourceObjects[] $sourceObjects
*/
public function setSourceObjects($sourceObjects)
{
$this->sourceObjects = $sourceObjects;
}
/**
* @return ComposeRequestSourceObjects[]
*/
public function getSourceObjects()
{
return $this->sourceObjects;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ComposeRequest::class, 'Google_Service_Storage_ComposeRequest');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/ComposeRequestSourceObjects.php
================================================
generation = $generation;
}
/**
* @return string
*/
public function getGeneration()
{
return $this->generation;
}
/**
* The source object's name. All source objects must reside in the same
* bucket.
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Conditions that must be met for this operation to execute.
*
* @param ComposeRequestSourceObjectsObjectPreconditions $objectPreconditions
*/
public function setObjectPreconditions(ComposeRequestSourceObjectsObjectPreconditions $objectPreconditions)
{
$this->objectPreconditions = $objectPreconditions;
}
/**
* @return ComposeRequestSourceObjectsObjectPreconditions
*/
public function getObjectPreconditions()
{
return $this->objectPreconditions;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ComposeRequestSourceObjects::class, 'Google_Service_Storage_ComposeRequestSourceObjects');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/ComposeRequestSourceObjectsObjectPreconditions.php
================================================
ifGenerationMatch = $ifGenerationMatch;
}
/**
* @return string
*/
public function getIfGenerationMatch()
{
return $this->ifGenerationMatch;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ComposeRequestSourceObjectsObjectPreconditions::class, 'Google_Service_Storage_ComposeRequestSourceObjectsObjectPreconditions');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Expr.php
================================================
description = $description;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Textual representation of an expression in Common Expression Language
* syntax. The application context of the containing message determines which
* well-known feature set of CEL is supported.
*
* @param string $expression
*/
public function setExpression($expression)
{
$this->expression = $expression;
}
/**
* @return string
*/
public function getExpression()
{
return $this->expression;
}
/**
* An optional string indicating the location of the expression for error
* reporting, e.g. a file name and a position in the file.
*
* @param string $location
*/
public function setLocation($location)
{
$this->location = $location;
}
/**
* @return string
*/
public function getLocation()
{
return $this->location;
}
/**
* An optional title for the expression, i.e. a short string describing its
* purpose. This can be used e.g. in UIs which allow to enter the expression.
*
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Expr::class, 'Google_Service_Storage_Expr');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Folder.php
================================================
bucket = $bucket;
}
/**
* @return string
*/
public function getBucket()
{
return $this->bucket;
}
/**
* The creation time of the folder in RFC 3339 format.
*
* @param string $createTime
*/
public function setCreateTime($createTime)
{
$this->createTime = $createTime;
}
/**
* @return string
*/
public function getCreateTime()
{
return $this->createTime;
}
/**
* The ID of the folder, including the bucket name, folder name.
*
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The kind of item this is. For folders, this is always storage#folder.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The version of the metadata for this folder. Used for preconditions and for
* detecting changes in metadata.
*
* @param string $metageneration
*/
public function setMetageneration($metageneration)
{
$this->metageneration = $metageneration;
}
/**
* @return string
*/
public function getMetageneration()
{
return $this->metageneration;
}
/**
* The name of the folder. Required if not specified by URL parameter.
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Only present if the folder is part of an ongoing rename folder operation.
* Contains information which can be used to query the operation status.
*
* @param FolderPendingRenameInfo $pendingRenameInfo
*/
public function setPendingRenameInfo(FolderPendingRenameInfo $pendingRenameInfo)
{
$this->pendingRenameInfo = $pendingRenameInfo;
}
/**
* @return FolderPendingRenameInfo
*/
public function getPendingRenameInfo()
{
return $this->pendingRenameInfo;
}
/**
* The link to this folder.
*
* @param string $selfLink
*/
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
/**
* @return string
*/
public function getSelfLink()
{
return $this->selfLink;
}
/**
* The modification time of the folder metadata in RFC 3339 format.
*
* @param string $updateTime
*/
public function setUpdateTime($updateTime)
{
$this->updateTime = $updateTime;
}
/**
* @return string
*/
public function getUpdateTime()
{
return $this->updateTime;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Folder::class, 'Google_Service_Storage_Folder');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/FolderPendingRenameInfo.php
================================================
operationId = $operationId;
}
/**
* @return string
*/
public function getOperationId()
{
return $this->operationId;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(FolderPendingRenameInfo::class, 'Google_Service_Storage_FolderPendingRenameInfo');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Folders.php
================================================
items = $items;
}
/**
* @return Folder[]
*/
public function getItems()
{
return $this->items;
}
/**
* The kind of item this is. For lists of folders, this is always
* storage#folders.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The continuation token, used to page through large result sets. Provide
* this value in a subsequent request to return the next page of results.
*
* @param string $nextPageToken
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Folders::class, 'Google_Service_Storage_Folders');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/GoogleLongrunningListOperationsResponse.php
================================================
kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The continuation token, used to page through large result sets. Provide
* this value in a subsequent request to return the next page of results.
*
* @param string $nextPageToken
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
/**
* A list of operations that matches the specified filter in the request.
*
* @param GoogleLongrunningOperation[] $operations
*/
public function setOperations($operations)
{
$this->operations = $operations;
}
/**
* @return GoogleLongrunningOperation[]
*/
public function getOperations()
{
return $this->operations;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(GoogleLongrunningListOperationsResponse::class, 'Google_Service_Storage_GoogleLongrunningListOperationsResponse');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/GoogleLongrunningOperation.php
================================================
done = $done;
}
/**
* @return bool
*/
public function getDone()
{
return $this->done;
}
/**
* The error result of the operation in case of failure or cancellation.
*
* @param GoogleRpcStatus $error
*/
public function setError(GoogleRpcStatus $error)
{
$this->error = $error;
}
/**
* @return GoogleRpcStatus
*/
public function getError()
{
return $this->error;
}
/**
* The kind of item this is. For operations, this is always storage#operation.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* Service-specific metadata associated with the operation. It typically
* contains progress information and common metadata such as create time. Some
* services might not provide such metadata. Any method that returns a long-
* running operation should document the metadata type, if any.
*
* @param array[] $metadata
*/
public function setMetadata($metadata)
{
$this->metadata = $metadata;
}
/**
* @return array[]
*/
public function getMetadata()
{
return $this->metadata;
}
/**
* The server-assigned name, which is only unique within the same service that
* originally returns it. If you use the default HTTP mapping, the "name"
* should be a resource name ending with "operations/{operationId}".
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The normal response of the operation in case of success. If the original
* method returns no data on success, such as "Delete", the response is
* google.protobuf.Empty. If the original method is standard
* Get/Create/Update, the response should be the resource. For other methods,
* the response should have the type "XxxResponse", where "Xxx" is the
* original method name. For example, if the original method name is
* "TakeSnapshot()", the inferred response type is "TakeSnapshotResponse".
*
* @param array[] $response
*/
public function setResponse($response)
{
$this->response = $response;
}
/**
* @return array[]
*/
public function getResponse()
{
return $this->response;
}
/**
* The link to this long running operation.
*
* @param string $selfLink
*/
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
/**
* @return string
*/
public function getSelfLink()
{
return $this->selfLink;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(GoogleLongrunningOperation::class, 'Google_Service_Storage_GoogleLongrunningOperation');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/GoogleRpcStatus.php
================================================
code = $code;
}
/**
* @return int
*/
public function getCode()
{
return $this->code;
}
/**
* A list of messages that carry the error details. There is a common set of
* message types for APIs to use.
*
* @param array[] $details
*/
public function setDetails($details)
{
$this->details = $details;
}
/**
* @return array[]
*/
public function getDetails()
{
return $this->details;
}
/**
* A developer-facing error message, which should be in English.
*
* @param string $message
*/
public function setMessage($message)
{
$this->message = $message;
}
/**
* @return string
*/
public function getMessage()
{
return $this->message;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(GoogleRpcStatus::class, 'Google_Service_Storage_GoogleRpcStatus');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/HmacKey.php
================================================
kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* Key metadata.
*
* @param HmacKeyMetadata $metadata
*/
public function setMetadata(HmacKeyMetadata $metadata)
{
$this->metadata = $metadata;
}
/**
* @return HmacKeyMetadata
*/
public function getMetadata()
{
return $this->metadata;
}
/**
* HMAC secret key material.
*
* @param string $secret
*/
public function setSecret($secret)
{
$this->secret = $secret;
}
/**
* @return string
*/
public function getSecret()
{
return $this->secret;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(HmacKey::class, 'Google_Service_Storage_HmacKey');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/HmacKeyMetadata.php
================================================
accessId = $accessId;
}
/**
* @return string
*/
public function getAccessId()
{
return $this->accessId;
}
/**
* HTTP 1.1 Entity tag for the HMAC key.
*
* @param string $etag
*/
public function setEtag($etag)
{
$this->etag = $etag;
}
/**
* @return string
*/
public function getEtag()
{
return $this->etag;
}
/**
* The ID of the HMAC key, including the Project ID and the Access ID.
*
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The kind of item this is. For HMAC Key metadata, this is always
* storage#hmacKeyMetadata.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* Project ID owning the service account to which the key authenticates.
*
* @param string $projectId
*/
public function setProjectId($projectId)
{
$this->projectId = $projectId;
}
/**
* @return string
*/
public function getProjectId()
{
return $this->projectId;
}
/**
* The link to this resource.
*
* @param string $selfLink
*/
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
/**
* @return string
*/
public function getSelfLink()
{
return $this->selfLink;
}
/**
* The email address of the key's associated service account.
*
* @param string $serviceAccountEmail
*/
public function setServiceAccountEmail($serviceAccountEmail)
{
$this->serviceAccountEmail = $serviceAccountEmail;
}
/**
* @return string
*/
public function getServiceAccountEmail()
{
return $this->serviceAccountEmail;
}
/**
* The state of the key. Can be one of ACTIVE, INACTIVE, or DELETED.
*
* @param string $state
*/
public function setState($state)
{
$this->state = $state;
}
/**
* @return string
*/
public function getState()
{
return $this->state;
}
/**
* The creation time of the HMAC key in RFC 3339 format.
*
* @param string $timeCreated
*/
public function setTimeCreated($timeCreated)
{
$this->timeCreated = $timeCreated;
}
/**
* @return string
*/
public function getTimeCreated()
{
return $this->timeCreated;
}
/**
* The last modification time of the HMAC key metadata in RFC 3339 format.
*
* @param string $updated
*/
public function setUpdated($updated)
{
$this->updated = $updated;
}
/**
* @return string
*/
public function getUpdated()
{
return $this->updated;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(HmacKeyMetadata::class, 'Google_Service_Storage_HmacKeyMetadata');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/HmacKeysMetadata.php
================================================
items = $items;
}
/**
* @return HmacKeyMetadata[]
*/
public function getItems()
{
return $this->items;
}
/**
* The kind of item this is. For lists of hmacKeys, this is always
* storage#hmacKeysMetadata.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The continuation token, used to page through large result sets. Provide
* this value in a subsequent request to return the next page of results.
*
* @param string $nextPageToken
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(HmacKeysMetadata::class, 'Google_Service_Storage_HmacKeysMetadata');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/ManagedFolder.php
================================================
bucket = $bucket;
}
/**
* @return string
*/
public function getBucket()
{
return $this->bucket;
}
/**
* The creation time of the managed folder in RFC 3339 format.
*
* @param string $createTime
*/
public function setCreateTime($createTime)
{
$this->createTime = $createTime;
}
/**
* @return string
*/
public function getCreateTime()
{
return $this->createTime;
}
/**
* The ID of the managed folder, including the bucket name and managed folder
* name.
*
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The kind of item this is. For managed folders, this is always
* storage#managedFolder.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The version of the metadata for this managed folder. Used for preconditions
* and for detecting changes in metadata.
*
* @param string $metageneration
*/
public function setMetageneration($metageneration)
{
$this->metageneration = $metageneration;
}
/**
* @return string
*/
public function getMetageneration()
{
return $this->metageneration;
}
/**
* The name of the managed folder. Required if not specified by URL parameter.
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The link to this managed folder.
*
* @param string $selfLink
*/
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
/**
* @return string
*/
public function getSelfLink()
{
return $this->selfLink;
}
/**
* The last update time of the managed folder metadata in RFC 3339 format.
*
* @param string $updateTime
*/
public function setUpdateTime($updateTime)
{
$this->updateTime = $updateTime;
}
/**
* @return string
*/
public function getUpdateTime()
{
return $this->updateTime;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ManagedFolder::class, 'Google_Service_Storage_ManagedFolder');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/ManagedFolders.php
================================================
items = $items;
}
/**
* @return ManagedFolder[]
*/
public function getItems()
{
return $this->items;
}
/**
* The kind of item this is. For lists of managed folders, this is always
* storage#managedFolders.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The continuation token, used to page through large result sets. Provide
* this value in a subsequent request to return the next page of results.
*
* @param string $nextPageToken
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ManagedFolders::class, 'Google_Service_Storage_ManagedFolders');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Notification.php
================================================
"custom_attributes",
"eventTypes" => "event_types",
"objectNamePrefix" => "object_name_prefix",
"payloadFormat" => "payload_format",
];
/**
* An optional list of additional attributes to attach to each Cloud PubSub
* message published for this notification subscription.
*
* @var string[]
*/
public $customAttributes;
/**
* HTTP 1.1 Entity tag for this subscription notification.
*
* @var string
*/
public $etag;
/**
* If present, only send notifications about listed event types. If empty,
* sent notifications for all event types.
*
* @var string[]
*/
public $eventTypes;
/**
* The ID of the notification.
*
* @var string
*/
public $id;
/**
* The kind of item this is. For notifications, this is always
* storage#notification.
*
* @var string
*/
public $kind;
/**
* If present, only apply this notification configuration to object names that
* begin with this prefix.
*
* @var string
*/
public $objectNamePrefix;
/**
* The desired content of the Payload.
*
* @var string
*/
public $payloadFormat;
/**
* The canonical URL of this notification.
*
* @var string
*/
public $selfLink;
/**
* The Cloud PubSub topic to which this subscription publishes. Formatted as:
* '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topic}'
*
* @var string
*/
public $topic;
/**
* An optional list of additional attributes to attach to each Cloud PubSub
* message published for this notification subscription.
*
* @param string[] $customAttributes
*/
public function setCustomAttributes($customAttributes)
{
$this->customAttributes = $customAttributes;
}
/**
* @return string[]
*/
public function getCustomAttributes()
{
return $this->customAttributes;
}
/**
* HTTP 1.1 Entity tag for this subscription notification.
*
* @param string $etag
*/
public function setEtag($etag)
{
$this->etag = $etag;
}
/**
* @return string
*/
public function getEtag()
{
return $this->etag;
}
/**
* If present, only send notifications about listed event types. If empty,
* sent notifications for all event types.
*
* @param string[] $eventTypes
*/
public function setEventTypes($eventTypes)
{
$this->eventTypes = $eventTypes;
}
/**
* @return string[]
*/
public function getEventTypes()
{
return $this->eventTypes;
}
/**
* The ID of the notification.
*
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The kind of item this is. For notifications, this is always
* storage#notification.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* If present, only apply this notification configuration to object names that
* begin with this prefix.
*
* @param string $objectNamePrefix
*/
public function setObjectNamePrefix($objectNamePrefix)
{
$this->objectNamePrefix = $objectNamePrefix;
}
/**
* @return string
*/
public function getObjectNamePrefix()
{
return $this->objectNamePrefix;
}
/**
* The desired content of the Payload.
*
* @param string $payloadFormat
*/
public function setPayloadFormat($payloadFormat)
{
$this->payloadFormat = $payloadFormat;
}
/**
* @return string
*/
public function getPayloadFormat()
{
return $this->payloadFormat;
}
/**
* The canonical URL of this notification.
*
* @param string $selfLink
*/
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
/**
* @return string
*/
public function getSelfLink()
{
return $this->selfLink;
}
/**
* The Cloud PubSub topic to which this subscription publishes. Formatted as:
* '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topic}'
*
* @param string $topic
*/
public function setTopic($topic)
{
$this->topic = $topic;
}
/**
* @return string
*/
public function getTopic()
{
return $this->topic;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Notification::class, 'Google_Service_Storage_Notification');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Notifications.php
================================================
items = $items;
}
/**
* @return Notification[]
*/
public function getItems()
{
return $this->items;
}
/**
* The kind of item this is. For lists of notifications, this is always
* storage#notifications.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Notifications::class, 'Google_Service_Storage_Notifications');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/ObjectAccessControl.php
================================================
bucket = $bucket;
}
/**
* @return string
*/
public function getBucket()
{
return $this->bucket;
}
/**
* The domain associated with the entity, if any.
*
* @param string $domain
*/
public function setDomain($domain)
{
$this->domain = $domain;
}
/**
* @return string
*/
public function getDomain()
{
return $this->domain;
}
/**
* The email address associated with the entity, if any.
*
* @param string $email
*/
public function setEmail($email)
{
$this->email = $email;
}
/**
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* The entity holding the permission, in one of the following forms: - user-
* userId - user-email - group-groupId - group-email - domain-domain -
* project-team-projectId - allUsers - allAuthenticatedUsers Examples: -
* The user liz@example.com would be user-liz@example.com. - The group
* example@googlegroups.com would be group-example@googlegroups.com. - To
* refer to all members of the Google Apps for Business domain example.com,
* the entity would be domain-example.com.
*
* @param string $entity
*/
public function setEntity($entity)
{
$this->entity = $entity;
}
/**
* @return string
*/
public function getEntity()
{
return $this->entity;
}
/**
* The ID for the entity, if any.
*
* @param string $entityId
*/
public function setEntityId($entityId)
{
$this->entityId = $entityId;
}
/**
* @return string
*/
public function getEntityId()
{
return $this->entityId;
}
/**
* HTTP 1.1 Entity tag for the access-control entry.
*
* @param string $etag
*/
public function setEtag($etag)
{
$this->etag = $etag;
}
/**
* @return string
*/
public function getEtag()
{
return $this->etag;
}
/**
* The content generation of the object, if applied to an object.
*
* @param string $generation
*/
public function setGeneration($generation)
{
$this->generation = $generation;
}
/**
* @return string
*/
public function getGeneration()
{
return $this->generation;
}
/**
* The ID of the access-control entry.
*
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The kind of item this is. For object access control entries, this is always
* storage#objectAccessControl.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The name of the object, if applied to an object.
*
* @param string $object
*/
public function setObject($object)
{
$this->object = $object;
}
/**
* @return string
*/
public function getObject()
{
return $this->object;
}
/**
* The project team associated with the entity, if any.
*
* @param ObjectAccessControlProjectTeam $projectTeam
*/
public function setProjectTeam(ObjectAccessControlProjectTeam $projectTeam)
{
$this->projectTeam = $projectTeam;
}
/**
* @return ObjectAccessControlProjectTeam
*/
public function getProjectTeam()
{
return $this->projectTeam;
}
/**
* The access permission for the entity.
*
* @param string $role
*/
public function setRole($role)
{
$this->role = $role;
}
/**
* @return string
*/
public function getRole()
{
return $this->role;
}
/**
* The link to this access-control entry.
*
* @param string $selfLink
*/
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
/**
* @return string
*/
public function getSelfLink()
{
return $this->selfLink;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ObjectAccessControl::class, 'Google_Service_Storage_ObjectAccessControl');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/ObjectAccessControlProjectTeam.php
================================================
projectNumber = $projectNumber;
}
/**
* @return string
*/
public function getProjectNumber()
{
return $this->projectNumber;
}
/**
* The team.
*
* @param string $team
*/
public function setTeam($team)
{
$this->team = $team;
}
/**
* @return string
*/
public function getTeam()
{
return $this->team;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ObjectAccessControlProjectTeam::class, 'Google_Service_Storage_ObjectAccessControlProjectTeam');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/ObjectAccessControls.php
================================================
items = $items;
}
/**
* @return ObjectAccessControl[]
*/
public function getItems()
{
return $this->items;
}
/**
* The kind of item this is. For lists of object access control entries, this
* is always storage#objectAccessControls.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ObjectAccessControls::class, 'Google_Service_Storage_ObjectAccessControls');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/ObjectCustomContextPayload.php
================================================
createTime = $createTime;
}
/**
* @return string
*/
public function getCreateTime()
{
return $this->createTime;
}
/**
* The time at which the object context was last updated in RFC 3339 format.
*
* @param string $updateTime
*/
public function setUpdateTime($updateTime)
{
$this->updateTime = $updateTime;
}
/**
* @return string
*/
public function getUpdateTime()
{
return $this->updateTime;
}
/**
* The value of the object context.
*
* @param string $value
*/
public function setValue($value)
{
$this->value = $value;
}
/**
* @return string
*/
public function getValue()
{
return $this->value;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ObjectCustomContextPayload::class, 'Google_Service_Storage_ObjectCustomContextPayload');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Objects.php
================================================
items = $items;
}
/**
* @return StorageObject[]
*/
public function getItems()
{
return $this->items;
}
/**
* The kind of item this is. For lists of objects, this is always
* storage#objects.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The continuation token, used to page through large result sets. Provide
* this value in a subsequent request to return the next page of results.
*
* @param string $nextPageToken
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
/**
* The list of prefixes of objects matching-but-not-listed up to and including
* the requested delimiter.
*
* @param string[] $prefixes
*/
public function setPrefixes($prefixes)
{
$this->prefixes = $prefixes;
}
/**
* @return string[]
*/
public function getPrefixes()
{
return $this->prefixes;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Objects::class, 'Google_Service_Storage_Objects');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Policy.php
================================================
bindings = $bindings;
}
/**
* @return PolicyBindings[]
*/
public function getBindings()
{
return $this->bindings;
}
/**
* HTTP 1.1 Entity tag for the policy.
*
* @param string $etag
*/
public function setEtag($etag)
{
$this->etag = $etag;
}
/**
* @return string
*/
public function getEtag()
{
return $this->etag;
}
/**
* The kind of item this is. For policies, this is always storage#policy. This
* field is ignored on input.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The ID of the resource to which this policy belongs. Will be of the form
* projects/_/buckets/bucket for buckets,
* projects/_/buckets/bucket/objects/object for objects, and
* projects/_/buckets/bucket/managedFolders/managedFolder. A specific
* generation may be specified by appending #generationNumber to the end of
* the object name, e.g. projects/_/buckets/my-bucket/objects/data.txt#17. The
* current generation can be denoted with #0. This field is ignored on input.
*
* @param string $resourceId
*/
public function setResourceId($resourceId)
{
$this->resourceId = $resourceId;
}
/**
* @return string
*/
public function getResourceId()
{
return $this->resourceId;
}
/**
* The IAM policy format version.
*
* @param int $version
*/
public function setVersion($version)
{
$this->version = $version;
}
/**
* @return int
*/
public function getVersion()
{
return $this->version;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Policy::class, 'Google_Service_Storage_Policy');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/PolicyBindings.php
================================================
condition = $condition;
}
/**
* @return Expr
*/
public function getCondition()
{
return $this->condition;
}
/**
* A collection of identifiers for members who may assume the provided role.
* Recognized identifiers are as follows: - allUsers - A special identifier
* that represents anyone on the internet; with or without a Google account.
* - allAuthenticatedUsers - A special identifier that represents anyone who
* is authenticated with a Google account or a service account. -
* user:emailid - An email address that represents a specific account. For
* example, user:alice@gmail.com or user:joe@example.com. -
* serviceAccount:emailid - An email address that represents a service
* account. For example, serviceAccount:my-other-
* app@appspot.gserviceaccount.com . - group:emailid - An email address that
* represents a Google group. For example, group:admins@example.com. -
* domain:domain - A Google Apps domain name that represents all the users of
* that domain. For example, domain:google.com or domain:example.com. -
* projectOwner:projectid - Owners of the given project. For example,
* projectOwner:my-example-project - projectEditor:projectid - Editors of
* the given project. For example, projectEditor:my-example-project -
* projectViewer:projectid - Viewers of the given project. For example,
* projectViewer:my-example-project
*
* @param string[] $members
*/
public function setMembers($members)
{
$this->members = $members;
}
/**
* @return string[]
*/
public function getMembers()
{
return $this->members;
}
/**
* The role to which members belong. Two types of roles are supported: new IAM
* roles, which grant permissions that do not map directly to those provided
* by ACLs, and legacy IAM roles, which do map directly to ACL permissions.
* All roles are of the format roles/storage.specificRole. The new IAM roles
* are: - roles/storage.admin - Full control of Google Cloud Storage
* resources. - roles/storage.objectViewer - Read-Only access to Google
* Cloud Storage objects. - roles/storage.objectCreator - Access to create
* objects in Google Cloud Storage. - roles/storage.objectAdmin - Full
* control of Google Cloud Storage objects. The legacy IAM roles are: -
* roles/storage.legacyObjectReader - Read-only access to objects without
* listing. Equivalent to an ACL entry on an object with the READER role. -
* roles/storage.legacyObjectOwner - Read/write access to existing objects
* without listing. Equivalent to an ACL entry on an object with the OWNER
* role. - roles/storage.legacyBucketReader - Read access to buckets with
* object listing. Equivalent to an ACL entry on a bucket with the READER
* role. - roles/storage.legacyBucketWriter - Read access to buckets with
* object listing/creation/deletion. Equivalent to an ACL entry on a bucket
* with the WRITER role. - roles/storage.legacyBucketOwner - Read and write
* access to existing buckets with object listing/creation/deletion.
* Equivalent to an ACL entry on a bucket with the OWNER role.
*
* @param string $role
*/
public function setRole($role)
{
$this->role = $role;
}
/**
* @return string
*/
public function getRole()
{
return $this->role;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(PolicyBindings::class, 'Google_Service_Storage_PolicyBindings');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/RelocateBucketRequest.php
================================================
destinationCustomPlacementConfig = $destinationCustomPlacementConfig;
}
/**
* @return RelocateBucketRequestDestinationCustomPlacementConfig
*/
public function getDestinationCustomPlacementConfig()
{
return $this->destinationCustomPlacementConfig;
}
/**
* The new location the bucket will be relocated to.
*
* @param string $destinationLocation
*/
public function setDestinationLocation($destinationLocation)
{
$this->destinationLocation = $destinationLocation;
}
/**
* @return string
*/
public function getDestinationLocation()
{
return $this->destinationLocation;
}
/**
* If true, validate the operation, but do not actually relocate the bucket.
*
* @param bool $validateOnly
*/
public function setValidateOnly($validateOnly)
{
$this->validateOnly = $validateOnly;
}
/**
* @return bool
*/
public function getValidateOnly()
{
return $this->validateOnly;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(RelocateBucketRequest::class, 'Google_Service_Storage_RelocateBucketRequest');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/RelocateBucketRequestDestinationCustomPlacementConfig.php
================================================
dataLocations = $dataLocations;
}
/**
* @return string[]
*/
public function getDataLocations()
{
return $this->dataLocations;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(RelocateBucketRequestDestinationCustomPlacementConfig::class, 'Google_Service_Storage_RelocateBucketRequestDestinationCustomPlacementConfig');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/AnywhereCache.php
================================================
* $storageService = new Google\Service\Storage(...);
* $anywhereCache = $storageService->anywhereCache;
*
*/
class AnywhereCache extends \Google\Service\Resource
{
/**
* Disables an Anywhere Cache instance. (anywhereCache.disable)
*
* @param string $bucket Name of the parent bucket.
* @param string $anywhereCacheId The ID of requested Anywhere Cache instance.
* @param array $optParams Optional parameters.
* @return AnywhereCacheModel
*/
public function disable($bucket, $anywhereCacheId, $optParams = [])
{
$params = ['bucket' => $bucket, 'anywhereCacheId' => $anywhereCacheId];
$params = array_merge($params, $optParams);
return $this->call('disable', [$params], AnywhereCacheModel::class);
}
/**
* Returns the metadata of an Anywhere Cache instance. (anywhereCache.get)
*
* @param string $bucket Name of the parent bucket.
* @param string $anywhereCacheId The ID of requested Anywhere Cache instance.
* @param array $optParams Optional parameters.
* @return AnywhereCacheModel
*/
public function get($bucket, $anywhereCacheId, $optParams = [])
{
$params = ['bucket' => $bucket, 'anywhereCacheId' => $anywhereCacheId];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], AnywhereCacheModel::class);
}
/**
* Creates an Anywhere Cache instance. (anywhereCache.insert)
*
* @param string $bucket Name of the parent bucket.
* @param AnywhereCacheModel $postBody
* @param array $optParams Optional parameters.
* @return GoogleLongrunningOperation
*/
public function insert($bucket, AnywhereCacheModel $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('insert', [$params], GoogleLongrunningOperation::class);
}
/**
* Returns a list of Anywhere Cache instances of the bucket matching the
* criteria. (anywhereCache.listAnywhereCache)
*
* @param string $bucket Name of the parent bucket.
* @param array $optParams Optional parameters.
*
* @opt_param int pageSize Maximum number of items return in a single page of
* responses. Maximum 1000.
* @opt_param string pageToken A previously-returned page token representing
* part of the larger set of results to view.
* @return AnywhereCaches
*/
public function listAnywhereCache($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], AnywhereCaches::class);
}
/**
* Pauses an Anywhere Cache instance. (anywhereCache.pause)
*
* @param string $bucket Name of the parent bucket.
* @param string $anywhereCacheId The ID of requested Anywhere Cache instance.
* @param array $optParams Optional parameters.
* @return AnywhereCacheModel
*/
public function pause($bucket, $anywhereCacheId, $optParams = [])
{
$params = ['bucket' => $bucket, 'anywhereCacheId' => $anywhereCacheId];
$params = array_merge($params, $optParams);
return $this->call('pause', [$params], AnywhereCacheModel::class);
}
/**
* Resumes a paused or disabled Anywhere Cache instance. (anywhereCache.resume)
*
* @param string $bucket Name of the parent bucket.
* @param string $anywhereCacheId The ID of requested Anywhere Cache instance.
* @param array $optParams Optional parameters.
* @return AnywhereCacheModel
*/
public function resume($bucket, $anywhereCacheId, $optParams = [])
{
$params = ['bucket' => $bucket, 'anywhereCacheId' => $anywhereCacheId];
$params = array_merge($params, $optParams);
return $this->call('resume', [$params], AnywhereCacheModel::class);
}
/**
* Updates the config(ttl and admissionPolicy) of an Anywhere Cache instance.
* (anywhereCache.update)
*
* @param string $bucket Name of the parent bucket.
* @param string $anywhereCacheId The ID of requested Anywhere Cache instance.
* @param AnywhereCacheModel $postBody
* @param array $optParams Optional parameters.
* @return GoogleLongrunningOperation
*/
public function update($bucket, $anywhereCacheId, AnywhereCacheModel $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'anywhereCacheId' => $anywhereCacheId, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('update', [$params], GoogleLongrunningOperation::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AnywhereCache::class, 'Google_Service_Storage_Resource_AnywhereCache');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/AnywhereCaches.php
================================================
* $storageService = new Google\Service\Storage(...);
* $anywhereCaches = $storageService->anywhereCaches;
*
*/
class AnywhereCaches extends \Google\Service\Resource
{
/**
* Disables an Anywhere Cache instance. (anywhereCaches.disable)
*
* @param string $bucket Name of the parent bucket.
* @param string $anywhereCacheId The ID of requested Anywhere Cache instance.
* @param array $optParams Optional parameters.
* @return AnywhereCache
* @throws \Google\Service\Exception
*/
public function disable($bucket, $anywhereCacheId, $optParams = [])
{
$params = ['bucket' => $bucket, 'anywhereCacheId' => $anywhereCacheId];
$params = array_merge($params, $optParams);
return $this->call('disable', [$params], AnywhereCache::class);
}
/**
* Returns the metadata of an Anywhere Cache instance. (anywhereCaches.get)
*
* @param string $bucket Name of the parent bucket.
* @param string $anywhereCacheId The ID of requested Anywhere Cache instance.
* @param array $optParams Optional parameters.
* @return AnywhereCache
* @throws \Google\Service\Exception
*/
public function get($bucket, $anywhereCacheId, $optParams = [])
{
$params = ['bucket' => $bucket, 'anywhereCacheId' => $anywhereCacheId];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], AnywhereCache::class);
}
/**
* Creates an Anywhere Cache instance. (anywhereCaches.insert)
*
* @param string $bucket Name of the parent bucket.
* @param AnywhereCache $postBody
* @param array $optParams Optional parameters.
* @return GoogleLongrunningOperation
* @throws \Google\Service\Exception
*/
public function insert($bucket, AnywhereCache $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('insert', [$params], GoogleLongrunningOperation::class);
}
/**
* Returns a list of Anywhere Cache instances of the bucket matching the
* criteria. (anywhereCaches.listAnywhereCaches)
*
* @param string $bucket Name of the parent bucket.
* @param array $optParams Optional parameters.
*
* @opt_param int pageSize Maximum number of items to return in a single page of
* responses. Maximum 1000.
* @opt_param string pageToken A previously-returned page token representing
* part of the larger set of results to view.
* @return AnywhereCachesModel
* @throws \Google\Service\Exception
*/
public function listAnywhereCaches($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], AnywhereCachesModel::class);
}
/**
* Pauses an Anywhere Cache instance. (anywhereCaches.pause)
*
* @param string $bucket Name of the parent bucket.
* @param string $anywhereCacheId The ID of requested Anywhere Cache instance.
* @param array $optParams Optional parameters.
* @return AnywhereCache
* @throws \Google\Service\Exception
*/
public function pause($bucket, $anywhereCacheId, $optParams = [])
{
$params = ['bucket' => $bucket, 'anywhereCacheId' => $anywhereCacheId];
$params = array_merge($params, $optParams);
return $this->call('pause', [$params], AnywhereCache::class);
}
/**
* Resumes a paused or disabled Anywhere Cache instance. (anywhereCaches.resume)
*
* @param string $bucket Name of the parent bucket.
* @param string $anywhereCacheId The ID of requested Anywhere Cache instance.
* @param array $optParams Optional parameters.
* @return AnywhereCache
* @throws \Google\Service\Exception
*/
public function resume($bucket, $anywhereCacheId, $optParams = [])
{
$params = ['bucket' => $bucket, 'anywhereCacheId' => $anywhereCacheId];
$params = array_merge($params, $optParams);
return $this->call('resume', [$params], AnywhereCache::class);
}
/**
* Updates the config(ttl and admissionPolicy) of an Anywhere Cache instance.
* (anywhereCaches.update)
*
* @param string $bucket Name of the parent bucket.
* @param string $anywhereCacheId The ID of requested Anywhere Cache instance.
* @param AnywhereCache $postBody
* @param array $optParams Optional parameters.
* @return GoogleLongrunningOperation
* @throws \Google\Service\Exception
*/
public function update($bucket, $anywhereCacheId, AnywhereCache $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'anywhereCacheId' => $anywhereCacheId, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('update', [$params], GoogleLongrunningOperation::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AnywhereCaches::class, 'Google_Service_Storage_Resource_AnywhereCaches');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/BucketAccessControls.php
================================================
* $storageService = new Google\Service\Storage(...);
* $bucketAccessControls = $storageService->bucketAccessControls;
*
*/
class BucketAccessControls extends \Google\Service\Resource
{
/**
* Permanently deletes the ACL entry for the specified entity on the specified
* bucket. (bucketAccessControls.delete)
*
* @param string $bucket Name of a bucket.
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @throws \Google\Service\Exception
*/
public function delete($bucket, $entity, $optParams = [])
{
$params = ['bucket' => $bucket, 'entity' => $entity];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params]);
}
/**
* Returns the ACL entry for the specified entity on the specified bucket.
* (bucketAccessControls.get)
*
* @param string $bucket Name of a bucket.
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return BucketAccessControl
* @throws \Google\Service\Exception
*/
public function get($bucket, $entity, $optParams = [])
{
$params = ['bucket' => $bucket, 'entity' => $entity];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], BucketAccessControl::class);
}
/**
* Creates a new ACL entry on the specified bucket.
* (bucketAccessControls.insert)
*
* @param string $bucket Name of a bucket.
* @param BucketAccessControl $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return BucketAccessControl
* @throws \Google\Service\Exception
*/
public function insert($bucket, BucketAccessControl $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('insert', [$params], BucketAccessControl::class);
}
/**
* Retrieves ACL entries on the specified bucket.
* (bucketAccessControls.listBucketAccessControls)
*
* @param string $bucket Name of a bucket.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return BucketAccessControlsModel
* @throws \Google\Service\Exception
*/
public function listBucketAccessControls($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], BucketAccessControlsModel::class);
}
/**
* Patches an ACL entry on the specified bucket. (bucketAccessControls.patch)
*
* @param string $bucket Name of a bucket.
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param BucketAccessControl $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return BucketAccessControl
* @throws \Google\Service\Exception
*/
public function patch($bucket, $entity, BucketAccessControl $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'entity' => $entity, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('patch', [$params], BucketAccessControl::class);
}
/**
* Updates an ACL entry on the specified bucket. (bucketAccessControls.update)
*
* @param string $bucket Name of a bucket.
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param BucketAccessControl $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return BucketAccessControl
* @throws \Google\Service\Exception
*/
public function update($bucket, $entity, BucketAccessControl $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'entity' => $entity, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('update', [$params], BucketAccessControl::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BucketAccessControls::class, 'Google_Service_Storage_Resource_BucketAccessControls');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Buckets.php
================================================
* $storageService = new Google\Service\Storage(...);
* $buckets = $storageService->buckets;
*
*/
class Buckets extends \Google\Service\Resource
{
/**
* Deletes an empty bucket. Deletions are permanent unless soft delete is
* enabled on the bucket. (buckets.delete)
*
* @param string $bucket Name of a bucket.
* @param array $optParams Optional parameters.
*
* @opt_param string ifMetagenerationMatch If set, only deletes the bucket if
* its metageneration matches this value.
* @opt_param string ifMetagenerationNotMatch If set, only deletes the bucket if
* its metageneration does not match this value.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @throws \Google\Service\Exception
*/
public function delete($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params]);
}
/**
* Returns metadata for the specified bucket. (buckets.get)
*
* @param string $bucket Name of a bucket.
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, specifies the generation of the
* bucket. This is required if softDeleted is true.
* @opt_param string ifMetagenerationMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current metageneration matches
* the given value.
* @opt_param string ifMetagenerationNotMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current metageneration does not
* match the given value.
* @opt_param string projection Set of properties to return. Defaults to noAcl.
* @opt_param bool softDeleted If true, return the soft-deleted version of this
* bucket. The default is false. For more information, see [Soft
* Delete](https://cloud.google.com/storage/docs/soft-delete).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Bucket
* @throws \Google\Service\Exception
*/
public function get($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], Bucket::class);
}
/**
* Returns an IAM policy for the specified bucket. (buckets.getIamPolicy)
*
* @param string $bucket Name of a bucket.
* @param array $optParams Optional parameters.
*
* @opt_param int optionsRequestedPolicyVersion The IAM policy format version to
* be returned. If the optionsRequestedPolicyVersion is for an older version
* that doesn't support part of the requested IAM policy, the request fails.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Policy
* @throws \Google\Service\Exception
*/
public function getIamPolicy($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('getIamPolicy', [$params], Policy::class);
}
/**
* Returns the storage layout configuration for the specified bucket. Note that
* this operation requires storage.objects.list permission.
* (buckets.getStorageLayout)
*
* @param string $bucket Name of a bucket.
* @param array $optParams Optional parameters.
*
* @opt_param string prefix An optional prefix used for permission check. It is
* useful when the caller only has storage.objects.list permission under a
* specific prefix.
* @return BucketStorageLayout
* @throws \Google\Service\Exception
*/
public function getStorageLayout($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('getStorageLayout', [$params], BucketStorageLayout::class);
}
/**
* Creates a new bucket. (buckets.insert)
*
* @param string $project A valid API project identifier.
* @param Bucket $postBody
* @param array $optParams Optional parameters.
*
* @opt_param bool enableObjectRetention When set to true, object retention is
* enabled for this bucket.
* @opt_param string predefinedAcl Apply a predefined set of access controls to
* this bucket.
* @opt_param string predefinedDefaultObjectAcl Apply a predefined set of
* default object access controls to this bucket.
* @opt_param string projection Set of properties to return. Defaults to noAcl,
* unless the bucket resource specifies acl or defaultObjectAcl properties, when
* it defaults to full.
* @opt_param string userProject The project to be billed for this request.
* @return Bucket
* @throws \Google\Service\Exception
*/
public function insert($project, Bucket $postBody, $optParams = [])
{
$params = ['project' => $project, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('insert', [$params], Bucket::class);
}
/**
* Retrieves a list of buckets for a given project. (buckets.listBuckets)
*
* @param string $project A valid API project identifier.
* @param array $optParams Optional parameters.
*
* @opt_param string maxResults Maximum number of buckets to return in a single
* response. The service will use this parameter or 1,000 items, whichever is
* smaller.
* @opt_param string pageToken A previously-returned page token representing
* part of the larger set of results to view.
* @opt_param string prefix Filter results to buckets whose names begin with
* this prefix.
* @opt_param string projection Set of properties to return. Defaults to noAcl.
* @opt_param bool returnPartialSuccess If true, return a list of bucket
* resource names for buckets that are in unreachable locations.
* @opt_param bool softDeleted If true, only soft-deleted bucket versions will
* be returned. The default is false. For more information, see [Soft
* Delete](https://cloud.google.com/storage/docs/soft-delete).
* @opt_param string userProject The project to be billed for this request.
* @return BucketsModel
* @throws \Google\Service\Exception
*/
public function listBuckets($project, $optParams = [])
{
$params = ['project' => $project];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], BucketsModel::class);
}
/**
* Locks retention policy on a bucket. (buckets.lockRetentionPolicy)
*
* @param string $bucket Name of a bucket.
* @param string $ifMetagenerationMatch Makes the operation conditional on
* whether bucket's current metageneration matches the given value.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Bucket
* @throws \Google\Service\Exception
*/
public function lockRetentionPolicy($bucket, $ifMetagenerationMatch, $optParams = [])
{
$params = ['bucket' => $bucket, 'ifMetagenerationMatch' => $ifMetagenerationMatch];
$params = array_merge($params, $optParams);
return $this->call('lockRetentionPolicy', [$params], Bucket::class);
}
/**
* Patches a bucket. Changes to the bucket will be readable immediately after
* writing, but configuration changes may take time to propagate.
* (buckets.patch)
*
* @param string $bucket Name of a bucket.
* @param Bucket $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string ifMetagenerationMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current metageneration matches
* the given value.
* @opt_param string ifMetagenerationNotMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current metageneration does not
* match the given value.
* @opt_param string predefinedAcl Apply a predefined set of access controls to
* this bucket.
* @opt_param string predefinedDefaultObjectAcl Apply a predefined set of
* default object access controls to this bucket.
* @opt_param string projection Set of properties to return. Defaults to full.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Bucket
* @throws \Google\Service\Exception
*/
public function patch($bucket, Bucket $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('patch', [$params], Bucket::class);
}
/**
* Initiates a long-running Relocate Bucket operation on the specified bucket.
* (buckets.relocate)
*
* @param string $bucket Name of the bucket to be moved.
* @param RelocateBucketRequest $postBody
* @param array $optParams Optional parameters.
* @return GoogleLongrunningOperation
* @throws \Google\Service\Exception
*/
public function relocate($bucket, RelocateBucketRequest $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('relocate', [$params], GoogleLongrunningOperation::class);
}
/**
* Restores a soft-deleted bucket. (buckets.restore)
*
* @param string $bucket Name of a bucket.
* @param string $generation Generation of a bucket.
* @param array $optParams Optional parameters.
*
* @opt_param string projection Set of properties to return. Defaults to full.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Bucket
* @throws \Google\Service\Exception
*/
public function restore($bucket, $generation, $optParams = [])
{
$params = ['bucket' => $bucket, 'generation' => $generation];
$params = array_merge($params, $optParams);
return $this->call('restore', [$params], Bucket::class);
}
/**
* Updates an IAM policy for the specified bucket. (buckets.setIamPolicy)
*
* @param string $bucket Name of a bucket.
* @param Policy $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Policy
* @throws \Google\Service\Exception
*/
public function setIamPolicy($bucket, Policy $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('setIamPolicy', [$params], Policy::class);
}
/**
* Tests a set of permissions on the given bucket to see which, if any, are held
* by the caller. (buckets.testIamPermissions)
*
* @param string $bucket Name of a bucket.
* @param string|array $permissions Permissions to test.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return TestIamPermissionsResponse
* @throws \Google\Service\Exception
*/
public function testIamPermissions($bucket, $permissions, $optParams = [])
{
$params = ['bucket' => $bucket, 'permissions' => $permissions];
$params = array_merge($params, $optParams);
return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
}
/**
* Updates a bucket. Changes to the bucket will be readable immediately after
* writing, but configuration changes may take time to propagate.
* (buckets.update)
*
* @param string $bucket Name of a bucket.
* @param Bucket $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string ifMetagenerationMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current metageneration matches
* the given value.
* @opt_param string ifMetagenerationNotMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current metageneration does not
* match the given value.
* @opt_param string predefinedAcl Apply a predefined set of access controls to
* this bucket.
* @opt_param string predefinedDefaultObjectAcl Apply a predefined set of
* default object access controls to this bucket.
* @opt_param string projection Set of properties to return. Defaults to full.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Bucket
* @throws \Google\Service\Exception
*/
public function update($bucket, Bucket $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('update', [$params], Bucket::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Buckets::class, 'Google_Service_Storage_Resource_Buckets');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Channels.php
================================================
* $storageService = new Google\Service\Storage(...);
* $channels = $storageService->channels;
*
*/
class Channels extends \Google\Service\Resource
{
/**
* Stop watching resources through this channel (channels.stop)
*
* @param Channel $postBody
* @param array $optParams Optional parameters.
* @throws \Google\Service\Exception
*/
public function stop(Channel $postBody, $optParams = [])
{
$params = ['postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('stop', [$params]);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Channels::class, 'Google_Service_Storage_Resource_Channels');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/DefaultObjectAccessControls.php
================================================
* $storageService = new Google\Service\Storage(...);
* $defaultObjectAccessControls = $storageService->defaultObjectAccessControls;
*
*/
class DefaultObjectAccessControls extends \Google\Service\Resource
{
/**
* Permanently deletes the default object ACL entry for the specified entity on
* the specified bucket. (defaultObjectAccessControls.delete)
*
* @param string $bucket Name of a bucket.
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @throws \Google\Service\Exception
*/
public function delete($bucket, $entity, $optParams = [])
{
$params = ['bucket' => $bucket, 'entity' => $entity];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params]);
}
/**
* Returns the default object ACL entry for the specified entity on the
* specified bucket. (defaultObjectAccessControls.get)
*
* @param string $bucket Name of a bucket.
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return ObjectAccessControl
* @throws \Google\Service\Exception
*/
public function get($bucket, $entity, $optParams = [])
{
$params = ['bucket' => $bucket, 'entity' => $entity];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], ObjectAccessControl::class);
}
/**
* Creates a new default object ACL entry on the specified bucket.
* (defaultObjectAccessControls.insert)
*
* @param string $bucket Name of a bucket.
* @param ObjectAccessControl $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return ObjectAccessControl
* @throws \Google\Service\Exception
*/
public function insert($bucket, ObjectAccessControl $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('insert', [$params], ObjectAccessControl::class);
}
/**
* Retrieves default object ACL entries on the specified bucket.
* (defaultObjectAccessControls.listDefaultObjectAccessControls)
*
* @param string $bucket Name of a bucket.
* @param array $optParams Optional parameters.
*
* @opt_param string ifMetagenerationMatch If present, only return default ACL
* listing if the bucket's current metageneration matches this value.
* @opt_param string ifMetagenerationNotMatch If present, only return default
* ACL listing if the bucket's current metageneration does not match the given
* value.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return ObjectAccessControlsModel
* @throws \Google\Service\Exception
*/
public function listDefaultObjectAccessControls($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ObjectAccessControlsModel::class);
}
/**
* Patches a default object ACL entry on the specified bucket.
* (defaultObjectAccessControls.patch)
*
* @param string $bucket Name of a bucket.
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param ObjectAccessControl $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return ObjectAccessControl
* @throws \Google\Service\Exception
*/
public function patch($bucket, $entity, ObjectAccessControl $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'entity' => $entity, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('patch', [$params], ObjectAccessControl::class);
}
/**
* Updates a default object ACL entry on the specified bucket.
* (defaultObjectAccessControls.update)
*
* @param string $bucket Name of a bucket.
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param ObjectAccessControl $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return ObjectAccessControl
* @throws \Google\Service\Exception
*/
public function update($bucket, $entity, ObjectAccessControl $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'entity' => $entity, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('update', [$params], ObjectAccessControl::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(DefaultObjectAccessControls::class, 'Google_Service_Storage_Resource_DefaultObjectAccessControls');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Folders.php
================================================
* $storageService = new Google\Service\Storage(...);
* $folders = $storageService->folders;
*
*/
class Folders extends \Google\Service\Resource
{
/**
* Permanently deletes a folder. Only applicable to buckets with hierarchical
* namespace enabled. (folders.delete)
*
* @param string $bucket Name of the bucket in which the folder resides.
* @param string $folder Name of a folder.
* @param array $optParams Optional parameters.
*
* @opt_param string ifMetagenerationMatch If set, only deletes the folder if
* its metageneration matches this value.
* @opt_param string ifMetagenerationNotMatch If set, only deletes the folder if
* its metageneration does not match this value.
* @throws \Google\Service\Exception
*/
public function delete($bucket, $folder, $optParams = [])
{
$params = ['bucket' => $bucket, 'folder' => $folder];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params]);
}
/**
* Returns metadata for the specified folder. Only applicable to buckets with
* hierarchical namespace enabled. (folders.get)
*
* @param string $bucket Name of the bucket in which the folder resides.
* @param string $folder Name of a folder.
* @param array $optParams Optional parameters.
*
* @opt_param string ifMetagenerationMatch Makes the return of the folder
* metadata conditional on whether the folder's current metageneration matches
* the given value.
* @opt_param string ifMetagenerationNotMatch Makes the return of the folder
* metadata conditional on whether the folder's current metageneration does not
* match the given value.
* @return Folder
* @throws \Google\Service\Exception
*/
public function get($bucket, $folder, $optParams = [])
{
$params = ['bucket' => $bucket, 'folder' => $folder];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], Folder::class);
}
/**
* Creates a new folder. Only applicable to buckets with hierarchical namespace
* enabled. (folders.insert)
*
* @param string $bucket Name of the bucket in which the folder resides.
* @param Folder $postBody
* @param array $optParams Optional parameters.
*
* @opt_param bool recursive If true, any parent folder which doesn't exist will
* be created automatically.
* @return Folder
* @throws \Google\Service\Exception
*/
public function insert($bucket, Folder $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('insert', [$params], Folder::class);
}
/**
* Retrieves a list of folders matching the criteria. Only applicable to buckets
* with hierarchical namespace enabled. (folders.listFolders)
*
* @param string $bucket Name of the bucket in which to look for folders.
* @param array $optParams Optional parameters.
*
* @opt_param string delimiter Returns results in a directory-like mode. The
* only supported value is '/'. If set, items will only contain folders that
* either exactly match the prefix, or are one level below the prefix.
* @opt_param string endOffset Filter results to folders whose names are
* lexicographically before endOffset. If startOffset is also set, the folders
* listed will have names between startOffset (inclusive) and endOffset
* (exclusive).
* @opt_param int pageSize Maximum number of items to return in a single page of
* responses.
* @opt_param string pageToken A previously-returned page token representing
* part of the larger set of results to view.
* @opt_param string prefix Filter results to folders whose paths begin with
* this prefix. If set, the value must either be an empty string or end with a
* '/'.
* @opt_param string startOffset Filter results to folders whose names are
* lexicographically equal to or after startOffset. If endOffset is also set,
* the folders listed will have names between startOffset (inclusive) and
* endOffset (exclusive).
* @return FoldersModel
* @throws \Google\Service\Exception
*/
public function listFolders($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], FoldersModel::class);
}
/**
* Renames a source folder to a destination folder. Only applicable to buckets
* with hierarchical namespace enabled. (folders.rename)
*
* @param string $bucket Name of the bucket in which the folders are in.
* @param string $sourceFolder Name of the source folder.
* @param string $destinationFolder Name of the destination folder.
* @param array $optParams Optional parameters.
*
* @opt_param string ifSourceMetagenerationMatch Makes the operation conditional
* on whether the source object's current metageneration matches the given
* value.
* @opt_param string ifSourceMetagenerationNotMatch Makes the operation
* conditional on whether the source object's current metageneration does not
* match the given value.
* @return GoogleLongrunningOperation
* @throws \Google\Service\Exception
*/
public function rename($bucket, $sourceFolder, $destinationFolder, $optParams = [])
{
$params = ['bucket' => $bucket, 'sourceFolder' => $sourceFolder, 'destinationFolder' => $destinationFolder];
$params = array_merge($params, $optParams);
return $this->call('rename', [$params], GoogleLongrunningOperation::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Folders::class, 'Google_Service_Storage_Resource_Folders');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/ManagedFolders.php
================================================
* $storageService = new Google\Service\Storage(...);
* $managedFolders = $storageService->managedFolders;
*
*/
class ManagedFolders extends \Google\Service\Resource
{
/**
* Permanently deletes a managed folder. (managedFolders.delete)
*
* @param string $bucket Name of the bucket containing the managed folder.
* @param string $managedFolder The managed folder name/path.
* @param array $optParams Optional parameters.
*
* @opt_param bool allowNonEmpty Allows the deletion of a managed folder even if
* it is not empty. A managed folder is empty if there are no objects or managed
* folders that it applies to. Callers must have
* storage.managedFolders.setIamPolicy permission.
* @opt_param string ifMetagenerationMatch If set, only deletes the managed
* folder if its metageneration matches this value.
* @opt_param string ifMetagenerationNotMatch If set, only deletes the managed
* folder if its metageneration does not match this value.
* @throws \Google\Service\Exception
*/
public function delete($bucket, $managedFolder, $optParams = [])
{
$params = ['bucket' => $bucket, 'managedFolder' => $managedFolder];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params]);
}
/**
* Returns metadata of the specified managed folder. (managedFolders.get)
*
* @param string $bucket Name of the bucket containing the managed folder.
* @param string $managedFolder The managed folder name/path.
* @param array $optParams Optional parameters.
*
* @opt_param string ifMetagenerationMatch Makes the return of the managed
* folder metadata conditional on whether the managed folder's current
* metageneration matches the given value.
* @opt_param string ifMetagenerationNotMatch Makes the return of the managed
* folder metadata conditional on whether the managed folder's current
* metageneration does not match the given value.
* @return ManagedFolder
* @throws \Google\Service\Exception
*/
public function get($bucket, $managedFolder, $optParams = [])
{
$params = ['bucket' => $bucket, 'managedFolder' => $managedFolder];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], ManagedFolder::class);
}
/**
* Returns an IAM policy for the specified managed folder.
* (managedFolders.getIamPolicy)
*
* @param string $bucket Name of the bucket containing the managed folder.
* @param string $managedFolder The managed folder name/path.
* @param array $optParams Optional parameters.
*
* @opt_param int optionsRequestedPolicyVersion The IAM policy format version to
* be returned. If the optionsRequestedPolicyVersion is for an older version
* that doesn't support part of the requested IAM policy, the request fails.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Policy
* @throws \Google\Service\Exception
*/
public function getIamPolicy($bucket, $managedFolder, $optParams = [])
{
$params = ['bucket' => $bucket, 'managedFolder' => $managedFolder];
$params = array_merge($params, $optParams);
return $this->call('getIamPolicy', [$params], Policy::class);
}
/**
* Creates a new managed folder. (managedFolders.insert)
*
* @param string $bucket Name of the bucket containing the managed folder.
* @param ManagedFolder $postBody
* @param array $optParams Optional parameters.
* @return ManagedFolder
* @throws \Google\Service\Exception
*/
public function insert($bucket, ManagedFolder $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('insert', [$params], ManagedFolder::class);
}
/**
* Lists managed folders in the given bucket.
* (managedFolders.listManagedFolders)
*
* @param string $bucket Name of the bucket containing the managed folder.
* @param array $optParams Optional parameters.
*
* @opt_param int pageSize Maximum number of items to return in a single page of
* responses.
* @opt_param string pageToken A previously-returned page token representing
* part of the larger set of results to view.
* @opt_param string prefix The managed folder name/path prefix to filter the
* output list of results.
* @return ManagedFoldersModel
* @throws \Google\Service\Exception
*/
public function listManagedFolders($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ManagedFoldersModel::class);
}
/**
* Updates an IAM policy for the specified managed folder.
* (managedFolders.setIamPolicy)
*
* @param string $bucket Name of the bucket containing the managed folder.
* @param string $managedFolder The managed folder name/path.
* @param Policy $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Policy
* @throws \Google\Service\Exception
*/
public function setIamPolicy($bucket, $managedFolder, Policy $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'managedFolder' => $managedFolder, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('setIamPolicy', [$params], Policy::class);
}
/**
* Tests a set of permissions on the given managed folder to see which, if any,
* are held by the caller. (managedFolders.testIamPermissions)
*
* @param string $bucket Name of the bucket containing the managed folder.
* @param string $managedFolder The managed folder name/path.
* @param string|array $permissions Permissions to test.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return TestIamPermissionsResponse
* @throws \Google\Service\Exception
*/
public function testIamPermissions($bucket, $managedFolder, $permissions, $optParams = [])
{
$params = ['bucket' => $bucket, 'managedFolder' => $managedFolder, 'permissions' => $permissions];
$params = array_merge($params, $optParams);
return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ManagedFolders::class, 'Google_Service_Storage_Resource_ManagedFolders');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Notifications.php
================================================
* $storageService = new Google\Service\Storage(...);
* $notifications = $storageService->notifications;
*
*/
class Notifications extends \Google\Service\Resource
{
/**
* Permanently deletes a notification subscription. (notifications.delete)
*
* @param string $bucket The parent bucket of the notification.
* @param string $notification ID of the notification to delete.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @throws \Google\Service\Exception
*/
public function delete($bucket, $notification, $optParams = [])
{
$params = ['bucket' => $bucket, 'notification' => $notification];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params]);
}
/**
* View a notification configuration. (notifications.get)
*
* @param string $bucket The parent bucket of the notification.
* @param string $notification Notification ID
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Notification
* @throws \Google\Service\Exception
*/
public function get($bucket, $notification, $optParams = [])
{
$params = ['bucket' => $bucket, 'notification' => $notification];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], Notification::class);
}
/**
* Creates a notification subscription for a given bucket.
* (notifications.insert)
*
* @param string $bucket The parent bucket of the notification.
* @param Notification $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Notification
* @throws \Google\Service\Exception
*/
public function insert($bucket, Notification $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('insert', [$params], Notification::class);
}
/**
* Retrieves a list of notification subscriptions for a given bucket.
* (notifications.listNotifications)
*
* @param string $bucket Name of a Google Cloud Storage bucket.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return NotificationsModel
* @throws \Google\Service\Exception
*/
public function listNotifications($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], NotificationsModel::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Notifications::class, 'Google_Service_Storage_Resource_Notifications');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/ObjectAccessControls.php
================================================
* $storageService = new Google\Service\Storage(...);
* $objectAccessControls = $storageService->objectAccessControls;
*
*/
class ObjectAccessControls extends \Google\Service\Resource
{
/**
* Permanently deletes the ACL entry for the specified entity on the specified
* object. (objectAccessControls.delete)
*
* @param string $bucket Name of a bucket.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @throws \Google\Service\Exception
*/
public function delete($bucket, $object, $entity, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object, 'entity' => $entity];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params]);
}
/**
* Returns the ACL entry for the specified entity on the specified object.
* (objectAccessControls.get)
*
* @param string $bucket Name of a bucket.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return ObjectAccessControl
* @throws \Google\Service\Exception
*/
public function get($bucket, $object, $entity, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object, 'entity' => $entity];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], ObjectAccessControl::class);
}
/**
* Creates a new ACL entry on the specified object.
* (objectAccessControls.insert)
*
* @param string $bucket Name of a bucket.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param ObjectAccessControl $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return ObjectAccessControl
* @throws \Google\Service\Exception
*/
public function insert($bucket, $object, ObjectAccessControl $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('insert', [$params], ObjectAccessControl::class);
}
/**
* Retrieves ACL entries on the specified object.
* (objectAccessControls.listObjectAccessControls)
*
* @param string $bucket Name of a bucket.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return ObjectAccessControlsModel
* @throws \Google\Service\Exception
*/
public function listObjectAccessControls($bucket, $object, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ObjectAccessControlsModel::class);
}
/**
* Patches an ACL entry on the specified object. (objectAccessControls.patch)
*
* @param string $bucket Name of a bucket.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param ObjectAccessControl $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return ObjectAccessControl
* @throws \Google\Service\Exception
*/
public function patch($bucket, $object, $entity, ObjectAccessControl $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object, 'entity' => $entity, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('patch', [$params], ObjectAccessControl::class);
}
/**
* Updates an ACL entry on the specified object. (objectAccessControls.update)
*
* @param string $bucket Name of a bucket.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param string $entity The entity holding the permission. Can be user-userId,
* user-emailAddress, group-groupId, group-emailAddress, allUsers, or
* allAuthenticatedUsers.
* @param ObjectAccessControl $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return ObjectAccessControl
* @throws \Google\Service\Exception
*/
public function update($bucket, $object, $entity, ObjectAccessControl $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object, 'entity' => $entity, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('update', [$params], ObjectAccessControl::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ObjectAccessControls::class, 'Google_Service_Storage_Resource_ObjectAccessControls');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Objects.php
================================================
* $storageService = new Google\Service\Storage(...);
* $objects = $storageService->objects;
*
*/
class Objects extends \Google\Service\Resource
{
/**
* Initiates a long-running bulk restore operation on the specified bucket.
* (objects.bulkRestore)
*
* @param string $bucket Name of the bucket in which the object resides.
* @param BulkRestoreObjectsRequest $postBody
* @param array $optParams Optional parameters.
* @return GoogleLongrunningOperation
* @throws \Google\Service\Exception
*/
public function bulkRestore($bucket, BulkRestoreObjectsRequest $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('bulkRestore', [$params], GoogleLongrunningOperation::class);
}
/**
* Concatenates a list of existing objects into a new object in the same bucket.
* (objects.compose)
*
* @param string $destinationBucket Name of the bucket containing the source
* objects. The destination object is stored in this bucket.
* @param string $destinationObject Name of the new object. For information
* about how to URL encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param ComposeRequest $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string destinationPredefinedAcl Apply a predefined set of access
* controls to the destination object.
* @opt_param string ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given value. Setting to 0
* makes the operation succeed only if there are no live versions of the object.
* @opt_param string ifMetagenerationMatch Makes the operation conditional on
* whether the object's current metageneration matches the given value.
* @opt_param string kmsKeyName Resource name of the Cloud KMS key, of the form
* projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that
* will be used to encrypt the object. Overrides the object metadata's
* kms_key_name value, if any.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return StorageObject
* @throws \Google\Service\Exception
*/
public function compose($destinationBucket, $destinationObject, ComposeRequest $postBody, $optParams = [])
{
$params = ['destinationBucket' => $destinationBucket, 'destinationObject' => $destinationObject, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('compose', [$params], StorageObject::class);
}
/**
* Copies a source object to a destination object. Optionally overrides
* metadata. (objects.copy)
*
* @param string $sourceBucket Name of the bucket in which to find the source
* object.
* @param string $sourceObject Name of the source object. For information about
* how to URL encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param string $destinationBucket Name of the bucket in which to store the new
* object. Overrides the provided object metadata's bucket value, if any.For
* information about how to URL encode object names to be path safe, see
* [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-
* endpoints#encoding).
* @param string $destinationObject Name of the new object. Required when the
* object metadata is not otherwise provided. Overrides the object metadata's
* name value, if any.
* @param StorageObject $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string destinationKmsKeyName Resource name of the Cloud KMS key,
* of the form projects/my-project/locations/global/keyRings/my-
* kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the
* object metadata's kms_key_name value, if any.
* @opt_param string destinationPredefinedAcl Apply a predefined set of access
* controls to the destination object.
* @opt_param string ifGenerationMatch Makes the operation conditional on
* whether the destination object's current generation matches the given value.
* Setting to 0 makes the operation succeed only if there are no live versions
* of the object.
* @opt_param string ifGenerationNotMatch Makes the operation conditional on
* whether the destination object's current generation does not match the given
* value. If no live object exists, the precondition fails. Setting to 0 makes
* the operation succeed only if there is a live version of the object.
* @opt_param string ifMetagenerationMatch Makes the operation conditional on
* whether the destination object's current metageneration matches the given
* value.
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on
* whether the destination object's current metageneration does not match the
* given value.
* @opt_param string ifSourceGenerationMatch Makes the operation conditional on
* whether the source object's current generation matches the given value.
* @opt_param string ifSourceGenerationNotMatch Makes the operation conditional
* on whether the source object's current generation does not match the given
* value.
* @opt_param string ifSourceMetagenerationMatch Makes the operation conditional
* on whether the source object's current metageneration matches the given
* value.
* @opt_param string ifSourceMetagenerationNotMatch Makes the operation
* conditional on whether the source object's current metageneration does not
* match the given value.
* @opt_param string projection Set of properties to return. Defaults to noAcl,
* unless the object resource specifies the acl property, when it defaults to
* full.
* @opt_param string sourceGeneration If present, selects a specific revision of
* the source object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return StorageObject
* @throws \Google\Service\Exception
*/
public function copy($sourceBucket, $sourceObject, $destinationBucket, $destinationObject, StorageObject $postBody, $optParams = [])
{
$params = ['sourceBucket' => $sourceBucket, 'sourceObject' => $sourceObject, 'destinationBucket' => $destinationBucket, 'destinationObject' => $destinationObject, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('copy', [$params], StorageObject::class);
}
/**
* Deletes an object and its metadata. Deletions are permanent if versioning is
* not enabled for the bucket, or if the generation parameter is used.
* (objects.delete)
*
* @param string $bucket Name of the bucket in which the object resides.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, permanently deletes a specific
* revision of this object (as opposed to the latest version, the default).
* @opt_param string ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given value. Setting to 0
* makes the operation succeed only if there are no live versions of the object.
* @opt_param string ifGenerationNotMatch Makes the operation conditional on
* whether the object's current generation does not match the given value. If no
* live object exists, the precondition fails. Setting to 0 makes the operation
* succeed only if there is a live version of the object.
* @opt_param string ifMetagenerationMatch Makes the operation conditional on
* whether the object's current metageneration matches the given value.
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on
* whether the object's current metageneration does not match the given value.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @throws \Google\Service\Exception
*/
public function delete($bucket, $object, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params]);
}
/**
* Retrieves an object or its metadata. (objects.get)
*
* @param string $bucket Name of the bucket in which the object resides.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given value. Setting to 0
* makes the operation succeed only if there are no live versions of the object.
* @opt_param string ifGenerationNotMatch Makes the operation conditional on
* whether the object's current generation does not match the given value. If no
* live object exists, the precondition fails. Setting to 0 makes the operation
* succeed only if there is a live version of the object.
* @opt_param string ifMetagenerationMatch Makes the operation conditional on
* whether the object's current metageneration matches the given value.
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on
* whether the object's current metageneration does not match the given value.
* @opt_param string projection Set of properties to return. Defaults to noAcl.
* @opt_param string restoreToken Restore token used to differentiate soft-
* deleted objects with the same name and generation. Only applicable for
* hierarchical namespace buckets and if softDeleted is set to true. This
* parameter is optional, and is only required in the rare case when there are
* multiple soft-deleted objects with the same name and generation.
* @opt_param bool softDeleted If true, only soft-deleted object versions will
* be listed. The default is false. For more information, see [Soft
* Delete](https://cloud.google.com/storage/docs/soft-delete).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return StorageObject
* @throws \Google\Service\Exception
*/
public function get($bucket, $object, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], StorageObject::class);
}
/**
* Returns an IAM policy for the specified object. (objects.getIamPolicy)
*
* @param string $bucket Name of the bucket in which the object resides.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Policy
* @throws \Google\Service\Exception
*/
public function getIamPolicy($bucket, $object, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object];
$params = array_merge($params, $optParams);
return $this->call('getIamPolicy', [$params], Policy::class);
}
/**
* Stores a new object and metadata. (objects.insert)
*
* @param string $bucket Name of the bucket in which to store the new object.
* Overrides the provided object metadata's bucket value, if any.
* @param StorageObject $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string contentEncoding If set, sets the contentEncoding property
* of the final object to this value. Setting this parameter is equivalent to
* setting the contentEncoding metadata property. This can be useful when
* uploading an object with uploadType=media to indicate the encoding of the
* content being uploaded.
* @opt_param string ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given value. Setting to 0
* makes the operation succeed only if there are no live versions of the object.
* @opt_param string ifGenerationNotMatch Makes the operation conditional on
* whether the object's current generation does not match the given value. If no
* live object exists, the precondition fails. Setting to 0 makes the operation
* succeed only if there is a live version of the object.
* @opt_param string ifMetagenerationMatch Makes the operation conditional on
* whether the object's current metageneration matches the given value.
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on
* whether the object's current metageneration does not match the given value.
* @opt_param string kmsKeyName Resource name of the Cloud KMS key, of the form
* projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that
* will be used to encrypt the object. Overrides the object metadata's
* kms_key_name value, if any.
* @opt_param string name Name of the object. Required when the object metadata
* is not otherwise provided. Overrides the object metadata's name value, if
* any. For information about how to URL encode object names to be path safe,
* see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-
* endpoints#encoding).
* @opt_param string predefinedAcl Apply a predefined set of access controls to
* this object.
* @opt_param string projection Set of properties to return. Defaults to noAcl,
* unless the object resource specifies the acl property, when it defaults to
* full.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return StorageObject
* @throws \Google\Service\Exception
*/
public function insert($bucket, StorageObject $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('insert', [$params], StorageObject::class);
}
/**
* Retrieves a list of objects matching the criteria. (objects.listObjects)
*
* @param string $bucket Name of the bucket in which to look for objects.
* @param array $optParams Optional parameters.
*
* @opt_param string delimiter Returns results in a directory-like mode. items
* will contain only objects whose names, aside from the prefix, do not contain
* delimiter. Objects whose names, aside from the prefix, contain delimiter will
* have their name, truncated after the delimiter, returned in prefixes.
* Duplicate prefixes are omitted.
* @opt_param string endOffset Filter results to objects whose names are
* lexicographically before endOffset. If startOffset is also set, the objects
* listed will have names between startOffset (inclusive) and endOffset
* (exclusive).
* @opt_param string filter Filter the returned objects. Currently only
* supported for the contexts field. If delimiter is set, the returned prefixes
* are exempt from this filter.
* @opt_param bool includeFoldersAsPrefixes Only applicable if delimiter is set
* to '/'. If true, will also include folders and managed folders (besides
* objects) in the returned prefixes.
* @opt_param bool includeTrailingDelimiter If true, objects that end in exactly
* one instance of delimiter will have their metadata included in items in
* addition to prefixes.
* @opt_param string matchGlob Filter results to objects and prefixes that match
* this glob pattern.
* @opt_param string maxResults Maximum number of items plus prefixes to return
* in a single page of responses. As duplicate prefixes are omitted, fewer total
* results may be returned than requested. The service will use this parameter
* or 1,000 items, whichever is smaller.
* @opt_param string pageToken A previously-returned page token representing
* part of the larger set of results to view.
* @opt_param string prefix Filter results to objects whose names begin with
* this prefix.
* @opt_param string projection Set of properties to return. Defaults to noAcl.
* @opt_param bool softDeleted If true, only soft-deleted object versions will
* be listed. The default is false. For more information, see [Soft
* Delete](https://cloud.google.com/storage/docs/soft-delete).
* @opt_param string startOffset Filter results to objects whose names are
* lexicographically equal to or after startOffset. If endOffset is also set,
* the objects listed will have names between startOffset (inclusive) and
* endOffset (exclusive).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @opt_param bool versions If true, lists all versions of an object as distinct
* results. The default is false. For more information, see [Object
* Versioning](https://cloud.google.com/storage/docs/object-versioning).
* @return ObjectsModel
* @throws \Google\Service\Exception
*/
public function listObjects($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ObjectsModel::class);
}
/**
* Moves the source object to the destination object in the same bucket.
* (objects.move)
*
* @param string $bucket Name of the bucket in which the object resides.
* @param string $sourceObject Name of the source object. For information about
* how to URL encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param string $destinationObject Name of the destination object. For
* information about how to URL encode object names to be path safe, see
* [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-
* endpoints#encoding).
* @param array $optParams Optional parameters.
*
* @opt_param string ifGenerationMatch Makes the operation conditional on
* whether the destination object's current generation matches the given value.
* Setting to 0 makes the operation succeed only if there are no live versions
* of the object. `ifGenerationMatch` and `ifGenerationNotMatch` conditions are
* mutually exclusive: it's an error for both of them to be set in the request.
* @opt_param string ifGenerationNotMatch Makes the operation conditional on
* whether the destination object's current generation does not match the given
* value. If no live object exists, the precondition fails. Setting to 0 makes
* the operation succeed only if there is a live version of the
* object.`ifGenerationMatch` and `ifGenerationNotMatch` conditions are mutually
* exclusive: it's an error for both of them to be set in the request.
* @opt_param string ifMetagenerationMatch Makes the operation conditional on
* whether the destination object's current metageneration matches the given
* value. `ifMetagenerationMatch` and `ifMetagenerationNotMatch` conditions are
* mutually exclusive: it's an error for both of them to be set in the request.
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on
* whether the destination object's current metageneration does not match the
* given value. `ifMetagenerationMatch` and `ifMetagenerationNotMatch`
* conditions are mutually exclusive: it's an error for both of them to be set
* in the request.
* @opt_param string ifSourceGenerationMatch Makes the operation conditional on
* whether the source object's current generation matches the given value.
* `ifSourceGenerationMatch` and `ifSourceGenerationNotMatch` conditions are
* mutually exclusive: it's an error for both of them to be set in the request.
* @opt_param string ifSourceGenerationNotMatch Makes the operation conditional
* on whether the source object's current generation does not match the given
* value. `ifSourceGenerationMatch` and `ifSourceGenerationNotMatch` conditions
* are mutually exclusive: it's an error for both of them to be set in the
* request.
* @opt_param string ifSourceMetagenerationMatch Makes the operation conditional
* on whether the source object's current metageneration matches the given
* value. `ifSourceMetagenerationMatch` and `ifSourceMetagenerationNotMatch`
* conditions are mutually exclusive: it's an error for both of them to be set
* in the request.
* @opt_param string ifSourceMetagenerationNotMatch Makes the operation
* conditional on whether the source object's current metageneration does not
* match the given value. `ifSourceMetagenerationMatch` and
* `ifSourceMetagenerationNotMatch` conditions are mutually exclusive: it's an
* error for both of them to be set in the request.
* @opt_param string projection Set of properties to return. Defaults to noAcl.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return StorageObject
* @throws \Google\Service\Exception
*/
public function move($bucket, $sourceObject, $destinationObject, $optParams = [])
{
$params = ['bucket' => $bucket, 'sourceObject' => $sourceObject, 'destinationObject' => $destinationObject];
$params = array_merge($params, $optParams);
return $this->call('move', [$params], StorageObject::class);
}
/**
* Patches an object's metadata. (objects.patch)
*
* @param string $bucket Name of the bucket in which the object resides.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param StorageObject $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given value. Setting to 0
* makes the operation succeed only if there are no live versions of the object.
* @opt_param string ifGenerationNotMatch Makes the operation conditional on
* whether the object's current generation does not match the given value. If no
* live object exists, the precondition fails. Setting to 0 makes the operation
* succeed only if there is a live version of the object.
* @opt_param string ifMetagenerationMatch Makes the operation conditional on
* whether the object's current metageneration matches the given value.
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on
* whether the object's current metageneration does not match the given value.
* @opt_param bool overrideUnlockedRetention Must be true to remove the
* retention configuration, reduce its unlocked retention period, or change its
* mode from unlocked to locked.
* @opt_param string predefinedAcl Apply a predefined set of access controls to
* this object.
* @opt_param string projection Set of properties to return. Defaults to full.
* @opt_param string userProject The project to be billed for this request, for
* Requester Pays buckets.
* @return StorageObject
* @throws \Google\Service\Exception
*/
public function patch($bucket, $object, StorageObject $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('patch', [$params], StorageObject::class);
}
/**
* Restores a soft-deleted object. (objects.restore)
*
* @param string $bucket Name of the bucket in which the object resides.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param string $generation Selects a specific revision of this object.
* @param array $optParams Optional parameters.
*
* @opt_param bool copySourceAcl If true, copies the source object's ACL;
* otherwise, uses the bucket's default object ACL. The default is false.
* @opt_param string ifGenerationMatch Makes the operation conditional on
* whether the object's one live generation matches the given value. Setting to
* 0 makes the operation succeed only if there are no live versions of the
* object.
* @opt_param string ifGenerationNotMatch Makes the operation conditional on
* whether none of the object's live generations match the given value. If no
* live object exists, the precondition fails. Setting to 0 makes the operation
* succeed only if there is a live version of the object.
* @opt_param string ifMetagenerationMatch Makes the operation conditional on
* whether the object's one live metageneration matches the given value.
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on
* whether none of the object's live metagenerations match the given value.
* @opt_param string projection Set of properties to return. Defaults to full.
* @opt_param string restoreToken Restore token used to differentiate sof-
* deleted objects with the same name and generation. Only applicable for
* hierarchical namespace buckets. This parameter is optional, and is only
* required in the rare case when there are multiple soft-deleted objects with
* the same name and generation.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return StorageObject
* @throws \Google\Service\Exception
*/
public function restore($bucket, $object, $generation, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object, 'generation' => $generation];
$params = array_merge($params, $optParams);
return $this->call('restore', [$params], StorageObject::class);
}
/**
* Rewrites a source object to a destination object. Optionally overrides
* metadata. (objects.rewrite)
*
* @param string $sourceBucket Name of the bucket in which to find the source
* object.
* @param string $sourceObject Name of the source object. For information about
* how to URL encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param string $destinationBucket Name of the bucket in which to store the new
* object. Overrides the provided object metadata's bucket value, if any.
* @param string $destinationObject Name of the new object. Required when the
* object metadata is not otherwise provided. Overrides the object metadata's
* name value, if any. For information about how to URL encode object names to
* be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param StorageObject $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string destinationKmsKeyName Resource name of the Cloud KMS key,
* of the form projects/my-project/locations/global/keyRings/my-
* kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the
* object metadata's kms_key_name value, if any.
* @opt_param string destinationPredefinedAcl Apply a predefined set of access
* controls to the destination object.
* @opt_param string ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given value. Setting to 0
* makes the operation succeed only if there are no live versions of the object.
* @opt_param string ifGenerationNotMatch Makes the operation conditional on
* whether the object's current generation does not match the given value. If no
* live object exists, the precondition fails. Setting to 0 makes the operation
* succeed only if there is a live version of the object.
* @opt_param string ifMetagenerationMatch Makes the operation conditional on
* whether the destination object's current metageneration matches the given
* value.
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on
* whether the destination object's current metageneration does not match the
* given value.
* @opt_param string ifSourceGenerationMatch Makes the operation conditional on
* whether the source object's current generation matches the given value.
* @opt_param string ifSourceGenerationNotMatch Makes the operation conditional
* on whether the source object's current generation does not match the given
* value.
* @opt_param string ifSourceMetagenerationMatch Makes the operation conditional
* on whether the source object's current metageneration matches the given
* value.
* @opt_param string ifSourceMetagenerationNotMatch Makes the operation
* conditional on whether the source object's current metageneration does not
* match the given value.
* @opt_param string maxBytesRewrittenPerCall The maximum number of bytes that
* will be rewritten per rewrite request. Most callers shouldn't need to specify
* this parameter - it is primarily in place to support testing. If specified
* the value must be an integral multiple of 1 MiB (1048576). Also, this only
* applies to requests where the source and destination span locations and/or
* storage classes. Finally, this value must not change across rewrite calls
* else you'll get an error that the rewriteToken is invalid.
* @opt_param string projection Set of properties to return. Defaults to noAcl,
* unless the object resource specifies the acl property, when it defaults to
* full.
* @opt_param string rewriteToken Include this field (from the previous rewrite
* response) on each rewrite request after the first one, until the rewrite
* response 'done' flag is true. Calls that provide a rewriteToken can omit all
* other request fields, but if included those fields must match the values
* provided in the first rewrite request.
* @opt_param string sourceGeneration If present, selects a specific revision of
* the source object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return RewriteResponse
* @throws \Google\Service\Exception
*/
public function rewrite($sourceBucket, $sourceObject, $destinationBucket, $destinationObject, StorageObject $postBody, $optParams = [])
{
$params = ['sourceBucket' => $sourceBucket, 'sourceObject' => $sourceObject, 'destinationBucket' => $destinationBucket, 'destinationObject' => $destinationObject, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('rewrite', [$params], RewriteResponse::class);
}
/**
* Updates an IAM policy for the specified object. (objects.setIamPolicy)
*
* @param string $bucket Name of the bucket in which the object resides.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param Policy $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return Policy
* @throws \Google\Service\Exception
*/
public function setIamPolicy($bucket, $object, Policy $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('setIamPolicy', [$params], Policy::class);
}
/**
* Tests a set of permissions on the given object to see which, if any, are held
* by the caller. (objects.testIamPermissions)
*
* @param string $bucket Name of the bucket in which the object resides.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param string|array $permissions Permissions to test.
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return TestIamPermissionsResponse
* @throws \Google\Service\Exception
*/
public function testIamPermissions($bucket, $object, $permissions, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object, 'permissions' => $permissions];
$params = array_merge($params, $optParams);
return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
}
/**
* Updates an object's metadata. (objects.update)
*
* @param string $bucket Name of the bucket in which the object resides.
* @param string $object Name of the object. For information about how to URL
* encode object names to be path safe, see [Encoding URI Path
* Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
* @param StorageObject $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string generation If present, selects a specific revision of this
* object (as opposed to the latest version, the default).
* @opt_param string ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given value. Setting to 0
* makes the operation succeed only if there are no live versions of the object.
* @opt_param string ifGenerationNotMatch Makes the operation conditional on
* whether the object's current generation does not match the given value. If no
* live object exists, the precondition fails. Setting to 0 makes the operation
* succeed only if there is a live version of the object.
* @opt_param string ifMetagenerationMatch Makes the operation conditional on
* whether the object's current metageneration matches the given value.
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on
* whether the object's current metageneration does not match the given value.
* @opt_param bool overrideUnlockedRetention Must be true to remove the
* retention configuration, reduce its unlocked retention period, or change its
* mode from unlocked to locked.
* @opt_param string predefinedAcl Apply a predefined set of access controls to
* this object.
* @opt_param string projection Set of properties to return. Defaults to full.
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @return StorageObject
* @throws \Google\Service\Exception
*/
public function update($bucket, $object, StorageObject $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'object' => $object, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('update', [$params], StorageObject::class);
}
/**
* Watch for changes on all objects in a bucket. (objects.watchAll)
*
* @param string $bucket Name of the bucket in which to look for objects.
* @param Channel $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string delimiter Returns results in a directory-like mode. items
* will contain only objects whose names, aside from the prefix, do not contain
* delimiter. Objects whose names, aside from the prefix, contain delimiter will
* have their name, truncated after the delimiter, returned in prefixes.
* Duplicate prefixes are omitted.
* @opt_param string endOffset Filter results to objects whose names are
* lexicographically before endOffset. If startOffset is also set, the objects
* listed will have names between startOffset (inclusive) and endOffset
* (exclusive).
* @opt_param bool includeTrailingDelimiter If true, objects that end in exactly
* one instance of delimiter will have their metadata included in items in
* addition to prefixes.
* @opt_param string maxResults Maximum number of items plus prefixes to return
* in a single page of responses. As duplicate prefixes are omitted, fewer total
* results may be returned than requested. The service will use this parameter
* or 1,000 items, whichever is smaller.
* @opt_param string pageToken A previously-returned page token representing
* part of the larger set of results to view.
* @opt_param string prefix Filter results to objects whose names begin with
* this prefix.
* @opt_param string projection Set of properties to return. Defaults to noAcl.
* @opt_param string startOffset Filter results to objects whose names are
* lexicographically equal to or after startOffset. If endOffset is also set,
* the objects listed will have names between startOffset (inclusive) and
* endOffset (exclusive).
* @opt_param string userProject The project to be billed for this request.
* Required for Requester Pays buckets.
* @opt_param bool versions If true, lists all versions of an object as distinct
* results. The default is false. For more information, see [Object
* Versioning](https://cloud.google.com/storage/docs/object-versioning).
* @return Channel
* @throws \Google\Service\Exception
*/
public function watchAll($bucket, Channel $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('watchAll', [$params], Channel::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Objects::class, 'Google_Service_Storage_Resource_Objects');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Operations.php
================================================
* $storageService = new Google\Service\Storage(...);
* $operations = $storageService->operations;
*
*/
class Operations extends \Google\Service\Resource
{
/**
* Starts asynchronous advancement of the relocate bucket operation in the case
* of required write downtime, to allow it to lock the bucket at the source
* location, and proceed with the bucket location swap. The server makes a best
* effort to advance the relocate bucket operation, but success is not
* guaranteed. (operations.advanceRelocateBucket)
*
* @param string $bucket Name of the bucket to advance the relocate for.
* @param string $operationId ID of the operation resource.
* @param AdvanceRelocateBucketOperationRequest $postBody
* @param array $optParams Optional parameters.
* @throws \Google\Service\Exception
*/
public function advanceRelocateBucket($bucket, $operationId, AdvanceRelocateBucketOperationRequest $postBody, $optParams = [])
{
$params = ['bucket' => $bucket, 'operationId' => $operationId, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('advanceRelocateBucket', [$params]);
}
/**
* Starts asynchronous cancellation on a long-running operation. The server
* makes a best effort to cancel the operation, but success is not guaranteed.
* (operations.cancel)
*
* @param string $bucket The parent bucket of the operation resource.
* @param string $operationId The ID of the operation resource.
* @param array $optParams Optional parameters.
* @throws \Google\Service\Exception
*/
public function cancel($bucket, $operationId, $optParams = [])
{
$params = ['bucket' => $bucket, 'operationId' => $operationId];
$params = array_merge($params, $optParams);
return $this->call('cancel', [$params]);
}
/**
* Gets the latest state of a long-running operation. (operations.get)
*
* @param string $bucket The parent bucket of the operation resource.
* @param string $operationId The ID of the operation resource.
* @param array $optParams Optional parameters.
* @return GoogleLongrunningOperation
* @throws \Google\Service\Exception
*/
public function get($bucket, $operationId, $optParams = [])
{
$params = ['bucket' => $bucket, 'operationId' => $operationId];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], GoogleLongrunningOperation::class);
}
/**
* Lists operations that match the specified filter in the request.
* (operations.listOperations)
*
* @param string $bucket Name of the bucket in which to look for operations.
* @param array $optParams Optional parameters.
*
* @opt_param string filter A filter to narrow down results to a preferred
* subset. The filtering language is documented in more detail in
* [AIP-160](https://google.aip.dev/160).
* @opt_param int pageSize Maximum number of items to return in a single page of
* responses. Fewer total results may be returned than requested. The service
* uses this parameter or 100 items, whichever is smaller.
* @opt_param string pageToken A previously-returned page token representing
* part of the larger set of results to view.
* @return GoogleLongrunningListOperationsResponse
* @throws \Google\Service\Exception
*/
public function listOperations($bucket, $optParams = [])
{
$params = ['bucket' => $bucket];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], GoogleLongrunningListOperationsResponse::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Operations::class, 'Google_Service_Storage_Resource_Operations');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/Projects.php
================================================
* $storageService = new Google\Service\Storage(...);
* $projects = $storageService->projects;
*
*/
class Projects extends \Google\Service\Resource
{
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Projects::class, 'Google_Service_Storage_Resource_Projects');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/ProjectsHmacKeys.php
================================================
* $storageService = new Google\Service\Storage(...);
* $hmacKeys = $storageService->projects_hmacKeys;
*
*/
class ProjectsHmacKeys extends \Google\Service\Resource
{
/**
* Creates a new HMAC key for the specified service account. (hmacKeys.create)
*
* @param string $projectId Project ID owning the service account.
* @param string $serviceAccountEmail Email address of the service account.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* @return HmacKey
* @throws \Google\Service\Exception
*/
public function create($projectId, $serviceAccountEmail, $optParams = [])
{
$params = ['projectId' => $projectId, 'serviceAccountEmail' => $serviceAccountEmail];
$params = array_merge($params, $optParams);
return $this->call('create', [$params], HmacKey::class);
}
/**
* Deletes an HMAC key. (hmacKeys.delete)
*
* @param string $projectId Project ID owning the requested key
* @param string $accessId Name of the HMAC key to be deleted.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* @throws \Google\Service\Exception
*/
public function delete($projectId, $accessId, $optParams = [])
{
$params = ['projectId' => $projectId, 'accessId' => $accessId];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params]);
}
/**
* Retrieves an HMAC key's metadata (hmacKeys.get)
*
* @param string $projectId Project ID owning the service account of the
* requested key.
* @param string $accessId Name of the HMAC key.
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* @return HmacKeyMetadata
* @throws \Google\Service\Exception
*/
public function get($projectId, $accessId, $optParams = [])
{
$params = ['projectId' => $projectId, 'accessId' => $accessId];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], HmacKeyMetadata::class);
}
/**
* Retrieves a list of HMAC keys matching the criteria.
* (hmacKeys.listProjectsHmacKeys)
*
* @param string $projectId Name of the project in which to look for HMAC keys.
* @param array $optParams Optional parameters.
*
* @opt_param string maxResults Maximum number of items to return in a single
* page of responses. The service uses this parameter or 250 items, whichever is
* smaller. The max number of items per page will also be limited by the number
* of distinct service accounts in the response. If the number of service
* accounts in a single response is too high, the page will truncated and a next
* page token will be returned.
* @opt_param string pageToken A previously-returned page token representing
* part of the larger set of results to view.
* @opt_param string serviceAccountEmail If present, only keys for the given
* service account are returned.
* @opt_param bool showDeletedKeys Whether or not to show keys in the DELETED
* state.
* @opt_param string userProject The project to be billed for this request.
* @return HmacKeysMetadata
* @throws \Google\Service\Exception
*/
public function listProjectsHmacKeys($projectId, $optParams = [])
{
$params = ['projectId' => $projectId];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], HmacKeysMetadata::class);
}
/**
* Updates the state of an HMAC key. See the [HMAC Key resource descriptor](http
* s://cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/update#reques
* t-body) for valid states. (hmacKeys.update)
*
* @param string $projectId Project ID owning the service account of the updated
* key.
* @param string $accessId Name of the HMAC key being updated.
* @param HmacKeyMetadata $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* @return HmacKeyMetadata
* @throws \Google\Service\Exception
*/
public function update($projectId, $accessId, HmacKeyMetadata $postBody, $optParams = [])
{
$params = ['projectId' => $projectId, 'accessId' => $accessId, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('update', [$params], HmacKeyMetadata::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProjectsHmacKeys::class, 'Google_Service_Storage_Resource_ProjectsHmacKeys');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/Resource/ProjectsServiceAccount.php
================================================
* $storageService = new Google\Service\Storage(...);
* $serviceAccount = $storageService->projects_serviceAccount;
*
*/
class ProjectsServiceAccount extends \Google\Service\Resource
{
/**
* Get the email address of this project's Google Cloud Storage service account.
* (serviceAccount.get)
*
* @param string $projectId Project ID
* @param array $optParams Optional parameters.
*
* @opt_param string userProject The project to be billed for this request.
* @return ServiceAccount
* @throws \Google\Service\Exception
*/
public function get($projectId, $optParams = [])
{
$params = ['projectId' => $projectId];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], ServiceAccount::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProjectsServiceAccount::class, 'Google_Service_Storage_Resource_ProjectsServiceAccount');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/RewriteResponse.php
================================================
done = $done;
}
/**
* @return bool
*/
public function getDone()
{
return $this->done;
}
/**
* The kind of item this is.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The total size of the object being copied in bytes. This property is always
* present in the response.
*
* @param string $objectSize
*/
public function setObjectSize($objectSize)
{
$this->objectSize = $objectSize;
}
/**
* @return string
*/
public function getObjectSize()
{
return $this->objectSize;
}
/**
* A resource containing the metadata for the copied-to object. This property
* is present in the response only when copying completes.
*
* @param StorageObject $resource
*/
public function setResource(StorageObject $resource)
{
$this->resource = $resource;
}
/**
* @return StorageObject
*/
public function getResource()
{
return $this->resource;
}
/**
* A token to use in subsequent requests to continue copying data. This token
* is present in the response only when there is more data to copy.
*
* @param string $rewriteToken
*/
public function setRewriteToken($rewriteToken)
{
$this->rewriteToken = $rewriteToken;
}
/**
* @return string
*/
public function getRewriteToken()
{
return $this->rewriteToken;
}
/**
* The total bytes written so far, which can be used to provide a waiting user
* with a progress indicator. This property is always present in the response.
*
* @param string $totalBytesRewritten
*/
public function setTotalBytesRewritten($totalBytesRewritten)
{
$this->totalBytesRewritten = $totalBytesRewritten;
}
/**
* @return string
*/
public function getTotalBytesRewritten()
{
return $this->totalBytesRewritten;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(RewriteResponse::class, 'Google_Service_Storage_RewriteResponse');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/ServiceAccount.php
================================================
"email_address",
];
/**
* The ID of the notification.
*
* @var string
*/
public $emailAddress;
/**
* The kind of item this is. For notifications, this is always
* storage#notification.
*
* @var string
*/
public $kind;
/**
* The ID of the notification.
*
* @param string $emailAddress
*/
public function setEmailAddress($emailAddress)
{
$this->emailAddress = $emailAddress;
}
/**
* @return string
*/
public function getEmailAddress()
{
return $this->emailAddress;
}
/**
* The kind of item this is. For notifications, this is always
* storage#notification.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ServiceAccount::class, 'Google_Service_Storage_ServiceAccount');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/StorageObject.php
================================================
acl = $acl;
}
/**
* @return ObjectAccessControl[]
*/
public function getAcl()
{
return $this->acl;
}
/**
* The name of the bucket containing this object.
*
* @param string $bucket
*/
public function setBucket($bucket)
{
$this->bucket = $bucket;
}
/**
* @return string
*/
public function getBucket()
{
return $this->bucket;
}
/**
* Cache-Control directive for the object data. If omitted, and the object is
* accessible to all anonymous users, the default will be public, max-
* age=3600.
*
* @param string $cacheControl
*/
public function setCacheControl($cacheControl)
{
$this->cacheControl = $cacheControl;
}
/**
* @return string
*/
public function getCacheControl()
{
return $this->cacheControl;
}
/**
* Number of underlying components that make up this object. Components are
* accumulated by compose operations.
*
* @param int $componentCount
*/
public function setComponentCount($componentCount)
{
$this->componentCount = $componentCount;
}
/**
* @return int
*/
public function getComponentCount()
{
return $this->componentCount;
}
/**
* Content-Disposition of the object data.
*
* @param string $contentDisposition
*/
public function setContentDisposition($contentDisposition)
{
$this->contentDisposition = $contentDisposition;
}
/**
* @return string
*/
public function getContentDisposition()
{
return $this->contentDisposition;
}
/**
* Content-Encoding of the object data.
*
* @param string $contentEncoding
*/
public function setContentEncoding($contentEncoding)
{
$this->contentEncoding = $contentEncoding;
}
/**
* @return string
*/
public function getContentEncoding()
{
return $this->contentEncoding;
}
/**
* Content-Language of the object data.
*
* @param string $contentLanguage
*/
public function setContentLanguage($contentLanguage)
{
$this->contentLanguage = $contentLanguage;
}
/**
* @return string
*/
public function getContentLanguage()
{
return $this->contentLanguage;
}
/**
* Content-Type of the object data. If an object is stored without a Content-
* Type, it is served as application/octet-stream.
*
* @param string $contentType
*/
public function setContentType($contentType)
{
$this->contentType = $contentType;
}
/**
* @return string
*/
public function getContentType()
{
return $this->contentType;
}
/**
* User-defined or system-defined object contexts. Each object context is a
* key-payload pair, where the key provides the identification and the payload
* holds the associated value and additional metadata.
*
* @param StorageObjectContexts $contexts
*/
public function setContexts(StorageObjectContexts $contexts)
{
$this->contexts = $contexts;
}
/**
* @return StorageObjectContexts
*/
public function getContexts()
{
return $this->contexts;
}
/**
* CRC32c checksum, as described in RFC 4960, Appendix B; encoded using base64
* in big-endian byte order. For more information about using the CRC32c
* checksum, see [Data Validation and Change
* Detection](https://cloud.google.com/storage/docs/data-validation).
*
* @param string $crc32c
*/
public function setCrc32c($crc32c)
{
$this->crc32c = $crc32c;
}
/**
* @return string
*/
public function getCrc32c()
{
return $this->crc32c;
}
/**
* A timestamp in RFC 3339 format specified by the user for an object.
*
* @param string $customTime
*/
public function setCustomTime($customTime)
{
$this->customTime = $customTime;
}
/**
* @return string
*/
public function getCustomTime()
{
return $this->customTime;
}
/**
* Metadata of customer-supplied encryption key, if the object is encrypted by
* such a key.
*
* @param StorageObjectCustomerEncryption $customerEncryption
*/
public function setCustomerEncryption(StorageObjectCustomerEncryption $customerEncryption)
{
$this->customerEncryption = $customerEncryption;
}
/**
* @return StorageObjectCustomerEncryption
*/
public function getCustomerEncryption()
{
return $this->customerEncryption;
}
/**
* HTTP 1.1 Entity tag for the object.
*
* @param string $etag
*/
public function setEtag($etag)
{
$this->etag = $etag;
}
/**
* @return string
*/
public function getEtag()
{
return $this->etag;
}
/**
* Whether an object is under event-based hold. Event-based hold is a way to
* retain objects until an event occurs, which is signified by the hold's
* release (i.e. this value is set to false). After being released (set to
* false), such objects will be subject to bucket-level retention (if any).
* One sample use case of this flag is for banks to hold loan documents for at
* least 3 years after loan is paid in full. Here, bucket-level retention is 3
* years and the event is the loan being paid in full. In this example, these
* objects will be held intact for any number of years until the event has
* occurred (event-based hold on the object is released) and then 3 more years
* after that. That means retention duration of the objects begins from the
* moment event-based hold transitioned from true to false.
*
* @param bool $eventBasedHold
*/
public function setEventBasedHold($eventBasedHold)
{
$this->eventBasedHold = $eventBasedHold;
}
/**
* @return bool
*/
public function getEventBasedHold()
{
return $this->eventBasedHold;
}
/**
* The content generation of this object. Used for object versioning.
*
* @param string $generation
*/
public function setGeneration($generation)
{
$this->generation = $generation;
}
/**
* @return string
*/
public function getGeneration()
{
return $this->generation;
}
/**
* This is the time (in the future) when the soft-deleted object will no
* longer be restorable. It is equal to the soft delete time plus the current
* soft delete retention duration of the bucket.
*
* @param string $hardDeleteTime
*/
public function setHardDeleteTime($hardDeleteTime)
{
$this->hardDeleteTime = $hardDeleteTime;
}
/**
* @return string
*/
public function getHardDeleteTime()
{
return $this->hardDeleteTime;
}
/**
* The ID of the object, including the bucket name, object name, and
* generation number.
*
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The kind of item this is. For objects, this is always storage#object.
*
* @param string $kind
*/
public function setKind($kind)
{
$this->kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* Not currently supported. Specifying the parameter causes the request to
* fail with status code 400 - Bad Request.
*
* @param string $kmsKeyName
*/
public function setKmsKeyName($kmsKeyName)
{
$this->kmsKeyName = $kmsKeyName;
}
/**
* @return string
*/
public function getKmsKeyName()
{
return $this->kmsKeyName;
}
/**
* MD5 hash of the data; encoded using base64. For more information about
* using the MD5 hash, see [Data Validation and Change
* Detection](https://cloud.google.com/storage/docs/data-validation).
*
* @param string $md5Hash
*/
public function setMd5Hash($md5Hash)
{
$this->md5Hash = $md5Hash;
}
/**
* @return string
*/
public function getMd5Hash()
{
return $this->md5Hash;
}
/**
* Media download link.
*
* @param string $mediaLink
*/
public function setMediaLink($mediaLink)
{
$this->mediaLink = $mediaLink;
}
/**
* @return string
*/
public function getMediaLink()
{
return $this->mediaLink;
}
/**
* User-provided metadata, in key/value pairs.
*
* @param string[] $metadata
*/
public function setMetadata($metadata)
{
$this->metadata = $metadata;
}
/**
* @return string[]
*/
public function getMetadata()
{
return $this->metadata;
}
/**
* The version of the metadata for this object at this generation. Used for
* preconditions and for detecting changes in metadata. A metageneration
* number is only meaningful in the context of a particular generation of a
* particular object.
*
* @param string $metageneration
*/
public function setMetageneration($metageneration)
{
$this->metageneration = $metageneration;
}
/**
* @return string
*/
public function getMetageneration()
{
return $this->metageneration;
}
/**
* The name of the object. Required if not specified by URL parameter.
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The owner of the object. This will always be the uploader of the object.
*
* @param StorageObjectOwner $owner
*/
public function setOwner(StorageObjectOwner $owner)
{
$this->owner = $owner;
}
/**
* @return StorageObjectOwner
*/
public function getOwner()
{
return $this->owner;
}
/**
* Restore token used to differentiate deleted objects with the same name and
* generation. This field is only returned for deleted objects in hierarchical
* namespace buckets.
*
* @param string $restoreToken
*/
public function setRestoreToken($restoreToken)
{
$this->restoreToken = $restoreToken;
}
/**
* @return string
*/
public function getRestoreToken()
{
return $this->restoreToken;
}
/**
* A collection of object level retention parameters.
*
* @param StorageObjectRetention $retention
*/
public function setRetention(StorageObjectRetention $retention)
{
$this->retention = $retention;
}
/**
* @return StorageObjectRetention
*/
public function getRetention()
{
return $this->retention;
}
/**
* A server-determined value that specifies the earliest time that the
* object's retention period expires. This value is in RFC 3339 format. Note
* 1: This field is not provided for objects with an active event-based hold,
* since retention expiration is unknown until the hold is removed. Note 2:
* This value can be provided even when temporary hold is set (so that the
* user can reason about policy without having to first unset the temporary
* hold).
*
* @param string $retentionExpirationTime
*/
public function setRetentionExpirationTime($retentionExpirationTime)
{
$this->retentionExpirationTime = $retentionExpirationTime;
}
/**
* @return string
*/
public function getRetentionExpirationTime()
{
return $this->retentionExpirationTime;
}
/**
* The link to this object.
*
* @param string $selfLink
*/
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
/**
* @return string
*/
public function getSelfLink()
{
return $this->selfLink;
}
/**
* Content-Length of the data in bytes.
*
* @param string $size
*/
public function setSize($size)
{
$this->size = $size;
}
/**
* @return string
*/
public function getSize()
{
return $this->size;
}
/**
* The time at which the object became soft-deleted in RFC 3339 format.
*
* @param string $softDeleteTime
*/
public function setSoftDeleteTime($softDeleteTime)
{
$this->softDeleteTime = $softDeleteTime;
}
/**
* @return string
*/
public function getSoftDeleteTime()
{
return $this->softDeleteTime;
}
/**
* Storage class of the object.
*
* @param string $storageClass
*/
public function setStorageClass($storageClass)
{
$this->storageClass = $storageClass;
}
/**
* @return string
*/
public function getStorageClass()
{
return $this->storageClass;
}
/**
* Whether an object is under temporary hold. While this flag is set to true,
* the object is protected against deletion and overwrites. A common use case
* of this flag is regulatory investigations where objects need to be retained
* while the investigation is ongoing. Note that unlike event-based hold,
* temporary hold does not impact retention expiration time of an object.
*
* @param bool $temporaryHold
*/
public function setTemporaryHold($temporaryHold)
{
$this->temporaryHold = $temporaryHold;
}
/**
* @return bool
*/
public function getTemporaryHold()
{
return $this->temporaryHold;
}
/**
* The creation time of the object in RFC 3339 format.
*
* @param string $timeCreated
*/
public function setTimeCreated($timeCreated)
{
$this->timeCreated = $timeCreated;
}
/**
* @return string
*/
public function getTimeCreated()
{
return $this->timeCreated;
}
/**
* The time at which the object became noncurrent in RFC 3339 format. Will be
* returned if and only if this version of the object has been deleted.
*
* @param string $timeDeleted
*/
public function setTimeDeleted($timeDeleted)
{
$this->timeDeleted = $timeDeleted;
}
/**
* @return string
*/
public function getTimeDeleted()
{
return $this->timeDeleted;
}
/**
* The time when the object was finalized.
*
* @param string $timeFinalized
*/
public function setTimeFinalized($timeFinalized)
{
$this->timeFinalized = $timeFinalized;
}
/**
* @return string
*/
public function getTimeFinalized()
{
return $this->timeFinalized;
}
/**
* The time at which the object's storage class was last changed. When the
* object is initially created, it will be set to timeCreated.
*
* @param string $timeStorageClassUpdated
*/
public function setTimeStorageClassUpdated($timeStorageClassUpdated)
{
$this->timeStorageClassUpdated = $timeStorageClassUpdated;
}
/**
* @return string
*/
public function getTimeStorageClassUpdated()
{
return $this->timeStorageClassUpdated;
}
/**
* The modification time of the object metadata in RFC 3339 format. Set
* initially to object creation time and then updated whenever any metadata of
* the object changes. This includes changes made by a requester, such as
* modifying custom metadata, as well as changes made by Cloud Storage on
* behalf of a requester, such as changing the storage class based on an
* Object Lifecycle Configuration.
*
* @param string $updated
*/
public function setUpdated($updated)
{
$this->updated = $updated;
}
/**
* @return string
*/
public function getUpdated()
{
return $this->updated;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(StorageObject::class, 'Google_Service_Storage_StorageObject');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectContexts.php
================================================
custom = $custom;
}
/**
* @return ObjectCustomContextPayload[]
*/
public function getCustom()
{
return $this->custom;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(StorageObjectContexts::class, 'Google_Service_Storage_StorageObjectContexts');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectCustomerEncryption.php
================================================
encryptionAlgorithm = $encryptionAlgorithm;
}
/**
* @return string
*/
public function getEncryptionAlgorithm()
{
return $this->encryptionAlgorithm;
}
/**
* SHA256 hash value of the encryption key.
*
* @param string $keySha256
*/
public function setKeySha256($keySha256)
{
$this->keySha256 = $keySha256;
}
/**
* @return string
*/
public function getKeySha256()
{
return $this->keySha256;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(StorageObjectCustomerEncryption::class, 'Google_Service_Storage_StorageObjectCustomerEncryption');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectOwner.php
================================================
entity = $entity;
}
/**
* @return string
*/
public function getEntity()
{
return $this->entity;
}
/**
* The ID for the entity.
*
* @param string $entityId
*/
public function setEntityId($entityId)
{
$this->entityId = $entityId;
}
/**
* @return string
*/
public function getEntityId()
{
return $this->entityId;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(StorageObjectOwner::class, 'Google_Service_Storage_StorageObjectOwner');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/StorageObjectRetention.php
================================================
mode = $mode;
}
/**
* @return string
*/
public function getMode()
{
return $this->mode;
}
/**
* A time in RFC 3339 format until which object retention protects this
* object.
*
* @param string $retainUntilTime
*/
public function setRetainUntilTime($retainUntilTime)
{
$this->retainUntilTime = $retainUntilTime;
}
/**
* @return string
*/
public function getRetainUntilTime()
{
return $this->retainUntilTime;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(StorageObjectRetention::class, 'Google_Service_Storage_StorageObjectRetention');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage/TestIamPermissionsResponse.php
================================================
kind = $kind;
}
/**
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The permissions held by the caller. Permissions are always of the format
* storage.resource.capability, where resource is one of buckets, objects, or
* managedFolders. The supported permissions are as follows: -
* storage.buckets.delete - Delete bucket. - storage.buckets.get - Read
* bucket metadata. - storage.buckets.getIamPolicy - Read bucket IAM policy.
* - storage.buckets.create - Create bucket. - storage.buckets.list - List
* buckets. - storage.buckets.setIamPolicy - Update bucket IAM policy. -
* storage.buckets.update - Update bucket metadata. - storage.objects.delete
* - Delete object. - storage.objects.get - Read object data and metadata.
* - storage.objects.getIamPolicy - Read object IAM policy. -
* storage.objects.create - Create object. - storage.objects.list - List
* objects. - storage.objects.setIamPolicy - Update object IAM policy. -
* storage.objects.update - Update object metadata. -
* storage.managedFolders.delete - Delete managed folder. -
* storage.managedFolders.get - Read managed folder metadata. -
* storage.managedFolders.getIamPolicy - Read managed folder IAM policy. -
* storage.managedFolders.create - Create managed folder. -
* storage.managedFolders.list - List managed folders. -
* storage.managedFolders.setIamPolicy - Update managed folder IAM policy.
*
* @param string[] $permissions
*/
public function setPermissions($permissions)
{
$this->permissions = $permissions;
}
/**
* @return string[]
*/
public function getPermissions()
{
return $this->permissions;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(TestIamPermissionsResponse::class, 'Google_Service_Storage_TestIamPermissionsResponse');
================================================
FILE: lib/Google/vendor/google/apiclient-services/src/Storage.php
================================================
* Stores and retrieves potentially large, immutable data objects.
*
*
* For more information about this service, see the API
* Documentation
*
*
* @author Google, Inc.
*/
class Storage extends \Google\Service
{
/** View and manage your data across Google Cloud Platform services. */
const CLOUD_PLATFORM =
"https://www.googleapis.com/auth/cloud-platform";
/** View your data across Google Cloud Platform services. */
const CLOUD_PLATFORM_READ_ONLY =
"https://www.googleapis.com/auth/cloud-platform.read-only";
/** Manage your data and permissions in Google Cloud Storage. */
const DEVSTORAGE_FULL_CONTROL =
"https://www.googleapis.com/auth/devstorage.full_control";
/** View your data in Google Cloud Storage. */
const DEVSTORAGE_READ_ONLY =
"https://www.googleapis.com/auth/devstorage.read_only";
/** Manage your data in Google Cloud Storage. */
const DEVSTORAGE_READ_WRITE =
"https://www.googleapis.com/auth/devstorage.read_write";
public $anywhereCaches;
public $bucketAccessControls;
public $buckets;
public $channels;
public $defaultObjectAccessControls;
public $folders;
public $managedFolders;
public $notifications;
public $objectAccessControls;
public $objects;
public $operations;
public $projects_hmacKeys;
public $projects_serviceAccount;
public $rootUrlTemplate;
/**
* Constructs the internal representation of the Storage service.
*
* @param Client|array $clientOrConfig The client used to deliver requests, or a
* config array to pass to a new Client instance.
* @param string $rootUrl The root URL used for requests to the service.
*/
public function __construct($clientOrConfig = [], $rootUrl = null)
{
parent::__construct($clientOrConfig);
$this->rootUrl = $rootUrl ?: 'https://storage.googleapis.com/';
$this->rootUrlTemplate = $rootUrl ?: 'https://storage.UNIVERSE_DOMAIN/';
$this->servicePath = 'storage/v1/';
$this->batchPath = 'batch/storage/v1';
$this->version = 'v1';
$this->serviceName = 'storage';
$this->anywhereCaches = new Storage\Resource\AnywhereCaches(
$this,
$this->serviceName,
'anywhereCaches',
[
'methods' => [
'disable' => [
'path' => 'b/{bucket}/anywhereCaches/{anywhereCacheId}/disable',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'anywhereCacheId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'get' => [
'path' => 'b/{bucket}/anywhereCaches/{anywhereCacheId}',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'anywhereCacheId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'insert' => [
'path' => 'b/{bucket}/anywhereCaches',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'list' => [
'path' => 'b/{bucket}/anywhereCaches',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
],
],'pause' => [
'path' => 'b/{bucket}/anywhereCaches/{anywhereCacheId}/pause',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'anywhereCacheId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'resume' => [
'path' => 'b/{bucket}/anywhereCaches/{anywhereCacheId}/resume',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'anywhereCacheId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'update' => [
'path' => 'b/{bucket}/anywhereCaches/{anywhereCacheId}',
'httpMethod' => 'PATCH',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'anywhereCacheId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],
]
]
);
$this->bucketAccessControls = new Storage\Resource\BucketAccessControls(
$this,
$this->serviceName,
'bucketAccessControls',
[
'methods' => [
'delete' => [
'path' => 'b/{bucket}/acl/{entity}',
'httpMethod' => 'DELETE',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'get' => [
'path' => 'b/{bucket}/acl/{entity}',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'insert' => [
'path' => 'b/{bucket}/acl',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'list' => [
'path' => 'b/{bucket}/acl',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'patch' => [
'path' => 'b/{bucket}/acl/{entity}',
'httpMethod' => 'PATCH',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'update' => [
'path' => 'b/{bucket}/acl/{entity}',
'httpMethod' => 'PUT',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->buckets = new Storage\Resource\Buckets(
$this,
$this->serviceName,
'buckets',
[
'methods' => [
'delete' => [
'path' => 'b/{bucket}',
'httpMethod' => 'DELETE',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'get' => [
'path' => 'b/{bucket}',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'softDeleted' => [
'location' => 'query',
'type' => 'boolean',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'getIamPolicy' => [
'path' => 'b/{bucket}/iam',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'optionsRequestedPolicyVersion' => [
'location' => 'query',
'type' => 'integer',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'getStorageLayout' => [
'path' => 'b/{bucket}/storageLayout',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'prefix' => [
'location' => 'query',
'type' => 'string',
],
],
],'insert' => [
'path' => 'b',
'httpMethod' => 'POST',
'parameters' => [
'project' => [
'location' => 'query',
'type' => 'string',
'required' => true,
],
'enableObjectRetention' => [
'location' => 'query',
'type' => 'boolean',
],
'predefinedAcl' => [
'location' => 'query',
'type' => 'string',
],
'predefinedDefaultObjectAcl' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'list' => [
'path' => 'b',
'httpMethod' => 'GET',
'parameters' => [
'project' => [
'location' => 'query',
'type' => 'string',
'required' => true,
],
'maxResults' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
'prefix' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'returnPartialSuccess' => [
'location' => 'query',
'type' => 'boolean',
],
'softDeleted' => [
'location' => 'query',
'type' => 'boolean',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'lockRetentionPolicy' => [
'path' => 'b/{bucket}/lockRetentionPolicy',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'patch' => [
'path' => 'b/{bucket}',
'httpMethod' => 'PATCH',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'predefinedAcl' => [
'location' => 'query',
'type' => 'string',
],
'predefinedDefaultObjectAcl' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'relocate' => [
'path' => 'b/{bucket}/relocate',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'restore' => [
'path' => 'b/{bucket}/restore',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
'required' => true,
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'setIamPolicy' => [
'path' => 'b/{bucket}/iam',
'httpMethod' => 'PUT',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'testIamPermissions' => [
'path' => 'b/{bucket}/iam/testPermissions',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'permissions' => [
'location' => 'query',
'type' => 'string',
'repeated' => true,
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'update' => [
'path' => 'b/{bucket}',
'httpMethod' => 'PUT',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'predefinedAcl' => [
'location' => 'query',
'type' => 'string',
],
'predefinedDefaultObjectAcl' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->channels = new Storage\Resource\Channels(
$this,
$this->serviceName,
'channels',
[
'methods' => [
'stop' => [
'path' => 'channels/stop',
'httpMethod' => 'POST',
'parameters' => [],
],
]
]
);
$this->defaultObjectAccessControls = new Storage\Resource\DefaultObjectAccessControls(
$this,
$this->serviceName,
'defaultObjectAccessControls',
[
'methods' => [
'delete' => [
'path' => 'b/{bucket}/defaultObjectAcl/{entity}',
'httpMethod' => 'DELETE',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'get' => [
'path' => 'b/{bucket}/defaultObjectAcl/{entity}',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'insert' => [
'path' => 'b/{bucket}/defaultObjectAcl',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'list' => [
'path' => 'b/{bucket}/defaultObjectAcl',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'patch' => [
'path' => 'b/{bucket}/defaultObjectAcl/{entity}',
'httpMethod' => 'PATCH',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'update' => [
'path' => 'b/{bucket}/defaultObjectAcl/{entity}',
'httpMethod' => 'PUT',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->folders = new Storage\Resource\Folders(
$this,
$this->serviceName,
'folders',
[
'methods' => [
'delete' => [
'path' => 'b/{bucket}/folders/{folder}',
'httpMethod' => 'DELETE',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'folder' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
],
],'get' => [
'path' => 'b/{bucket}/folders/{folder}',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'folder' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
],
],'insert' => [
'path' => 'b/{bucket}/folders',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'recursive' => [
'location' => 'query',
'type' => 'boolean',
],
],
],'list' => [
'path' => 'b/{bucket}/folders',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'delimiter' => [
'location' => 'query',
'type' => 'string',
],
'endOffset' => [
'location' => 'query',
'type' => 'string',
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
'prefix' => [
'location' => 'query',
'type' => 'string',
],
'startOffset' => [
'location' => 'query',
'type' => 'string',
],
],
],'rename' => [
'path' => 'b/{bucket}/folders/{sourceFolder}/renameTo/folders/{destinationFolder}',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'sourceFolder' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'destinationFolder' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'ifSourceMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->managedFolders = new Storage\Resource\ManagedFolders(
$this,
$this->serviceName,
'managedFolders',
[
'methods' => [
'delete' => [
'path' => 'b/{bucket}/managedFolders/{managedFolder}',
'httpMethod' => 'DELETE',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'managedFolder' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'allowNonEmpty' => [
'location' => 'query',
'type' => 'boolean',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
],
],'get' => [
'path' => 'b/{bucket}/managedFolders/{managedFolder}',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'managedFolder' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
],
],'getIamPolicy' => [
'path' => 'b/{bucket}/managedFolders/{managedFolder}/iam',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'managedFolder' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'optionsRequestedPolicyVersion' => [
'location' => 'query',
'type' => 'integer',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'insert' => [
'path' => 'b/{bucket}/managedFolders',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'list' => [
'path' => 'b/{bucket}/managedFolders',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
'prefix' => [
'location' => 'query',
'type' => 'string',
],
],
],'setIamPolicy' => [
'path' => 'b/{bucket}/managedFolders/{managedFolder}/iam',
'httpMethod' => 'PUT',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'managedFolder' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'testIamPermissions' => [
'path' => 'b/{bucket}/managedFolders/{managedFolder}/iam/testPermissions',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'managedFolder' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'permissions' => [
'location' => 'query',
'type' => 'string',
'repeated' => true,
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->notifications = new Storage\Resource\Notifications(
$this,
$this->serviceName,
'notifications',
[
'methods' => [
'delete' => [
'path' => 'b/{bucket}/notificationConfigs/{notification}',
'httpMethod' => 'DELETE',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'notification' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'get' => [
'path' => 'b/{bucket}/notificationConfigs/{notification}',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'notification' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'insert' => [
'path' => 'b/{bucket}/notificationConfigs',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'list' => [
'path' => 'b/{bucket}/notificationConfigs',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->objectAccessControls = new Storage\Resource\ObjectAccessControls(
$this,
$this->serviceName,
'objectAccessControls',
[
'methods' => [
'delete' => [
'path' => 'b/{bucket}/o/{object}/acl/{entity}',
'httpMethod' => 'DELETE',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'get' => [
'path' => 'b/{bucket}/o/{object}/acl/{entity}',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'insert' => [
'path' => 'b/{bucket}/o/{object}/acl',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'list' => [
'path' => 'b/{bucket}/o/{object}/acl',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'patch' => [
'path' => 'b/{bucket}/o/{object}/acl/{entity}',
'httpMethod' => 'PATCH',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'update' => [
'path' => 'b/{bucket}/o/{object}/acl/{entity}',
'httpMethod' => 'PUT',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'entity' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->objects = new Storage\Resource\Objects(
$this,
$this->serviceName,
'objects',
[
'methods' => [
'bulkRestore' => [
'path' => 'b/{bucket}/o/bulkRestore',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'compose' => [
'path' => 'b/{destinationBucket}/o/{destinationObject}/compose',
'httpMethod' => 'POST',
'parameters' => [
'destinationBucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'destinationObject' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'destinationPredefinedAcl' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'kmsKeyName' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'copy' => [
'path' => 'b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}',
'httpMethod' => 'POST',
'parameters' => [
'sourceBucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'sourceObject' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'destinationBucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'destinationObject' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'destinationKmsKeyName' => [
'location' => 'query',
'type' => 'string',
],
'destinationPredefinedAcl' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'sourceGeneration' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'delete' => [
'path' => 'b/{bucket}/o/{object}',
'httpMethod' => 'DELETE',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'get' => [
'path' => 'b/{bucket}/o/{object}',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'restoreToken' => [
'location' => 'query',
'type' => 'string',
],
'softDeleted' => [
'location' => 'query',
'type' => 'boolean',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'getIamPolicy' => [
'path' => 'b/{bucket}/o/{object}/iam',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'insert' => [
'path' => 'b/{bucket}/o',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'contentEncoding' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'kmsKeyName' => [
'location' => 'query',
'type' => 'string',
],
'name' => [
'location' => 'query',
'type' => 'string',
],
'predefinedAcl' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'list' => [
'path' => 'b/{bucket}/o',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'delimiter' => [
'location' => 'query',
'type' => 'string',
],
'endOffset' => [
'location' => 'query',
'type' => 'string',
],
'filter' => [
'location' => 'query',
'type' => 'string',
],
'includeFoldersAsPrefixes' => [
'location' => 'query',
'type' => 'boolean',
],
'includeTrailingDelimiter' => [
'location' => 'query',
'type' => 'boolean',
],
'matchGlob' => [
'location' => 'query',
'type' => 'string',
],
'maxResults' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
'prefix' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'softDeleted' => [
'location' => 'query',
'type' => 'boolean',
],
'startOffset' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
'versions' => [
'location' => 'query',
'type' => 'boolean',
],
],
],'move' => [
'path' => 'b/{bucket}/o/{sourceObject}/moveTo/o/{destinationObject}',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'sourceObject' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'destinationObject' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'ifGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'patch' => [
'path' => 'b/{bucket}/o/{object}',
'httpMethod' => 'PATCH',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'overrideUnlockedRetention' => [
'location' => 'query',
'type' => 'boolean',
],
'predefinedAcl' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'restore' => [
'path' => 'b/{bucket}/o/{object}/restore',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
'required' => true,
],
'copySourceAcl' => [
'location' => 'query',
'type' => 'boolean',
],
'ifGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'restoreToken' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'rewrite' => [
'path' => 'b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}',
'httpMethod' => 'POST',
'parameters' => [
'sourceBucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'sourceObject' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'destinationBucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'destinationObject' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'destinationKmsKeyName' => [
'location' => 'query',
'type' => 'string',
],
'destinationPredefinedAcl' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifSourceMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'maxBytesRewrittenPerCall' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'rewriteToken' => [
'location' => 'query',
'type' => 'string',
],
'sourceGeneration' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'setIamPolicy' => [
'path' => 'b/{bucket}/o/{object}/iam',
'httpMethod' => 'PUT',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'testIamPermissions' => [
'path' => 'b/{bucket}/o/{object}/iam/testPermissions',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'permissions' => [
'location' => 'query',
'type' => 'string',
'repeated' => true,
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'update' => [
'path' => 'b/{bucket}/o/{object}',
'httpMethod' => 'PUT',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'object' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'generation' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifGenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationMatch' => [
'location' => 'query',
'type' => 'string',
],
'ifMetagenerationNotMatch' => [
'location' => 'query',
'type' => 'string',
],
'overrideUnlockedRetention' => [
'location' => 'query',
'type' => 'boolean',
],
'predefinedAcl' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'watchAll' => [
'path' => 'b/{bucket}/o/watch',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'delimiter' => [
'location' => 'query',
'type' => 'string',
],
'endOffset' => [
'location' => 'query',
'type' => 'string',
],
'includeTrailingDelimiter' => [
'location' => 'query',
'type' => 'boolean',
],
'maxResults' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
'prefix' => [
'location' => 'query',
'type' => 'string',
],
'projection' => [
'location' => 'query',
'type' => 'string',
],
'startOffset' => [
'location' => 'query',
'type' => 'string',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
'versions' => [
'location' => 'query',
'type' => 'boolean',
],
],
],
]
]
);
$this->operations = new Storage\Resource\Operations(
$this,
$this->serviceName,
'operations',
[
'methods' => [
'advanceRelocateBucket' => [
'path' => 'b/{bucket}/operations/{operationId}/advanceRelocateBucket',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'operationId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'cancel' => [
'path' => 'b/{bucket}/operations/{operationId}/cancel',
'httpMethod' => 'POST',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'operationId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'get' => [
'path' => 'b/{bucket}/operations/{operationId}',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'operationId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'list' => [
'path' => 'b/{bucket}/operations',
'httpMethod' => 'GET',
'parameters' => [
'bucket' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'filter' => [
'location' => 'query',
'type' => 'string',
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->projects_hmacKeys = new Storage\Resource\ProjectsHmacKeys(
$this,
$this->serviceName,
'hmacKeys',
[
'methods' => [
'create' => [
'path' => 'projects/{projectId}/hmacKeys',
'httpMethod' => 'POST',
'parameters' => [
'projectId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'serviceAccountEmail' => [
'location' => 'query',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'delete' => [
'path' => 'projects/{projectId}/hmacKeys/{accessId}',
'httpMethod' => 'DELETE',
'parameters' => [
'projectId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'accessId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'get' => [
'path' => 'projects/{projectId}/hmacKeys/{accessId}',
'httpMethod' => 'GET',
'parameters' => [
'projectId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'accessId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'list' => [
'path' => 'projects/{projectId}/hmacKeys',
'httpMethod' => 'GET',
'parameters' => [
'projectId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'maxResults' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
'serviceAccountEmail' => [
'location' => 'query',
'type' => 'string',
],
'showDeletedKeys' => [
'location' => 'query',
'type' => 'boolean',
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],'update' => [
'path' => 'projects/{projectId}/hmacKeys/{accessId}',
'httpMethod' => 'PUT',
'parameters' => [
'projectId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'accessId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->projects_serviceAccount = new Storage\Resource\ProjectsServiceAccount(
$this,
$this->serviceName,
'serviceAccount',
[
'methods' => [
'get' => [
'path' => 'projects/{projectId}/serviceAccount',
'httpMethod' => 'GET',
'parameters' => [
'projectId' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'userProject' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Storage::class, 'Google_Service_Storage');
================================================
FILE: lib/Google/vendor/google/auth/.repo-metadata.json
================================================
{
"language": "php",
"distribution_name": "google/auth",
"release_level": "stable",
"client_documentation": "https://cloud.google.com/php/docs/reference/auth/latest",
"library_type": "CORE"
}
================================================
FILE: lib/Google/vendor/google/auth/COPYING
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: lib/Google/vendor/google/auth/LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: lib/Google/vendor/google/auth/README.md
================================================
# Google Auth Library for PHP
Reference Docs
## Description
This is Google's officially supported PHP client library for using OAuth 2.0
authorization and authentication with Google APIs.
### Installing via Composer
The recommended way to install the google auth library is through
[Composer](http://getcomposer.org).
```bash
# Install Composer
curl -sS https://getcomposer.org/installer | php
```
Next, run the Composer command to install the latest stable version:
```bash
composer.phar require google/auth
```
## Application Default Credentials
This library provides an implementation of
[Application Default Credentials (ADC)][application default credentials] for PHP.
Application Default Credentials provides a simple way to get authorization
credentials for use in calling Google APIs, and is
the recommended approach to authorize calls to Cloud APIs.
**Important**: If you accept a credential configuration (credential JSON/File/Stream) from an
external source for authentication to Google Cloud Platform, you must validate it before providing
it to any Google API or library. Providing an unvalidated credential configuration to Google APIs
can compromise the security of your systems and data. For more information, refer to
[Validate credential configurations from external sources][externally-sourced-credentials].
[externally-sourced-credentials]: https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
### Set up ADC
To use ADC, you must set it up by providing credentials.
How you set up ADC depends on the environment where your code is running,
and whether you are running code in a test or production environment.
For more information, see [Set up Application Default Credentials][set-up-adc].
### Enable the API you want to use
Before making your API call, you must be sure the API you're calling has been
enabled. Go to **APIs & Auth** > **APIs** in the
[Google Developers Console][developer console] and enable the APIs you'd like to
call. For the example below, you must enable the `Drive API`.
### Call the APIs
As long as you update the environment variable below to point to *your* JSON
credentials file, the following code should output a list of your Drive files.
```php
use Google\Auth\ApplicationDefaultCredentials;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
// specify the path to your application credentials
putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json');
// define the scopes for your API call
$scopes = ['https://www.googleapis.com/auth/drive.readonly'];
// create middleware
$middleware = ApplicationDefaultCredentials::getMiddleware($scopes);
$stack = HandlerStack::create();
$stack->push($middleware);
// create the HTTP client
$client = new Client([
'handler' => $stack,
'base_uri' => 'https://www.googleapis.com',
'auth' => 'google_auth' // authorize all requests
]);
// make the request
$response = $client->get('drive/v2/files');
// show the result!
print_r((string) $response->getBody());
```
##### Guzzle 5 Compatibility
If you are using [Guzzle 5][Guzzle 5], replace the `create middleware` and
`create the HTTP Client` steps with the following:
```php
// create the HTTP client
$client = new Client([
'base_url' => 'https://www.googleapis.com',
'auth' => 'google_auth' // authorize all requests
]);
// create subscriber
$subscriber = ApplicationDefaultCredentials::getSubscriber($scopes);
$client->getEmitter()->attach($subscriber);
```
#### Call using an ID Token
If your application is running behind Cloud Run, or using Cloud Identity-Aware
Proxy (IAP), you will need to fetch an ID token to access your application. For
this, use the static method `getIdTokenMiddleware` on
`ApplicationDefaultCredentials`.
```php
use Google\Auth\ApplicationDefaultCredentials;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
// specify the path to your application credentials
putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json');
// Provide the ID token audience. This can be a Client ID associated with an IAP application,
// Or the URL associated with a CloudRun App
// $targetAudience = 'IAP_CLIENT_ID.apps.googleusercontent.com';
// $targetAudience = 'https://service-1234-uc.a.run.app';
$targetAudience = 'YOUR_ID_TOKEN_AUDIENCE';
// create middleware
$middleware = ApplicationDefaultCredentials::getIdTokenMiddleware($targetAudience);
$stack = HandlerStack::create();
$stack->push($middleware);
// create the HTTP client
$client = new Client([
'handler' => $stack,
'auth' => 'google_auth',
// Cloud Run, IAP, or custom resource URL
'base_uri' => 'https://YOUR_PROTECTED_RESOURCE',
]);
// make the request
$response = $client->get('/');
// show the result!
print_r((string) $response->getBody());
```
For invoking Cloud Run services, your service account will need the
[`Cloud Run Invoker`](https://cloud.google.com/run/docs/authenticating/service-to-service)
IAM permission.
For invoking Cloud Identity-Aware Proxy, you will need to pass the Client ID
used when you set up your protected resource as the target audience. See how to
[secure your IAP app with signed headers](https://cloud.google.com/iap/docs/signed-headers-howto).
#### Call using a specific JSON key
If you want to use a specific JSON key instead of using `GOOGLE_APPLICATION_CREDENTIALS` environment variable, you can
do this:
```php
use Google\Auth\CredentialsLoader;
use Google\Auth\Middleware\AuthTokenMiddleware;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
// Define the Google Application Credentials array
$jsonKey = ['key' => 'value'];
// define the scopes for your API call
$scopes = ['https://www.googleapis.com/auth/drive.readonly'];
// Load credentials from JSON containing service account credentials.
$creds = new ServiceAccountCredentials($scopes, $jsonKey),
// For other credentials types, create those classes explicitly using the
// "type" field in the JSON key, for example:
$creds = match ($jsonKey['type']) {
'service_account' => new ServiceAccountCredentials($scope, $jsonKey),
'authorized_user' => new UserRefreshCredentials($scope, $jsonKey),
default => throw new InvalidArgumentException('This application only supports service account and user account credentials'),
};
// optional caching
$creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache);
// create middleware
$middleware = new AuthTokenMiddleware($creds);
$stack = HandlerStack::create();
$stack->push($middleware);
// create the HTTP client
$client = new Client([
'handler' => $stack,
'base_uri' => 'https://www.googleapis.com',
'auth' => 'google_auth' // authorize all requests
]);
// make the request
$response = $client->get('drive/v2/files');
// show the result!
print_r((string) $response->getBody());
```
#### Call using Proxy-Authorization Header
If your application is behind a proxy such as [Google Cloud IAP][iap-proxy-header],
and your application occupies the `Authorization` request header,
you can include the ID token in a `Proxy-Authorization: Bearer`
header instead. If a valid ID token is found in a `Proxy-Authorization` header,
IAP authorizes the request with it. After authorizing the request, IAP passes
the Authorization header to your application without processing the content.
For this, use the static method `getProxyIdTokenMiddleware` on
`ApplicationDefaultCredentials`.
```php
use Google\Auth\ApplicationDefaultCredentials;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
// specify the path to your application credentials
putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json');
// Provide the ID token audience. This can be a Client ID associated with an IAP application
// $targetAudience = 'IAP_CLIENT_ID.apps.googleusercontent.com';
$targetAudience = 'YOUR_ID_TOKEN_AUDIENCE';
// create middleware
$middleware = ApplicationDefaultCredentials::getProxyIdTokenMiddleware($targetAudience);
$stack = HandlerStack::create();
$stack->push($middleware);
// create the HTTP client
$client = new Client([
'handler' => $stack,
'auth' => ['username', 'pass'], // auth option handled by your application
'proxy_auth' => 'google_auth',
]);
// make the request
$response = $client->get('/');
// show the result!
print_r((string) $response->getBody());
```
[iap-proxy-header]: https://cloud.google.com/iap/docs/authentication-howto#authenticating_from_proxy-authorization_header
#### External credentials (Workload identity federation)
Using workload identity federation, your application can access Google Cloud resources from Amazon Web Services (AWS),
Microsoft Azure or any identity provider that supports OpenID Connect (OIDC).
Traditionally, applications running outside Google Cloud have used service account keys to access Google Cloud
resources. Using identity federation, you can allow your workload to impersonate a service account. This lets you access
Google Cloud resources directly, eliminating the maintenance and security burden associated with service account keys.
Follow the detailed instructions on how to
[Configure Workload Identity Federation](https://cloud.google.com/iam/docs/workload-identity-federation-with-other-clouds).
#### Verifying JWTs
If you are [using Google ID tokens to authenticate users][google-id-tokens], use
the `Google\Auth\AccessToken` class to verify the ID token:
```php
use Google\Auth\AccessToken;
$auth = new AccessToken();
$auth->verify($idToken);
```
If your app is running behind [Google Identity-Aware Proxy][iap-id-tokens]
(IAP), you can verify the ID token coming from the IAP server by pointing to the
appropriate certificate URL for IAP. This is because IAP signs the ID
tokens with a different key than the Google Identity service:
```php
use Google\Auth\AccessToken;
$auth = new AccessToken();
$auth->verify($idToken, [
'certsLocation' => AccessToken::IAP_CERT_URL
]);
```
[google-id-tokens]: https://developers.google.com/identity/sign-in/web/backend-auth
[iap-id-tokens]: https://cloud.google.com/iap/docs/signed-headers-howto
## Caching
Caching is enabled by passing a PSR-6 `CacheItemPoolInterface`
instance to the constructor when instantiating the credentials.
We offer some caching classes out of the box under the `Google\Auth\Cache` namespace.
```php
use Google\Auth\ApplicationDefaultCredentials;
use Google\Auth\Cache\MemoryCacheItemPool;
// Cache Instance
$memoryCache = new MemoryCacheItemPool;
// Get the credentials
// From here, the credentials will cache the access token
$middleware = ApplicationDefaultCredentials::getCredentials($scope, cache: $memoryCache);
```
### FileSystemCacheItemPool Cache
The `FileSystemCacheItemPool` class is a `PSR-6` compliant cache that stores its
serialized objects on disk, caching data between processes and making it possible
to use data between different requests.
```php
use Google\Auth\Cache\FileSystemCacheItemPool;
use Google\Auth\ApplicationDefaultCredentials;
// Create a Cache pool instance
$cache = new FileSystemCacheItemPool(__DIR__ . '/cache');
// Pass your Cache to the Auth Library
$credentials = ApplicationDefaultCredentials::getCredentials($scope, cache: $cache);
// This token will be cached and be able to be used for the next request
$token = $credentials->fetchAuthToken();
```
### Integrating with a third party cache
You can use a third party that follows the `PSR-6` interface of your choice.
```php
// run "composer require symfony/cache"
use Google\Auth\ApplicationDefaultCredentials;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
// Create the cache instance
$filesystemCache = new FilesystemAdapter();
// Create Get the credentials
$credentials = ApplicationDefaultCredentials::getCredentials($targetAudience, cache: $filesystemCache);
```
## License
This library is licensed under Apache 2.0. Full license text is
available in [COPYING][copying].
## Contributing
See [CONTRIBUTING][contributing].
## Support
Please
[report bugs at the project on Github](https://github.com/google/google-auth-library-php/issues). Don't
hesitate to
[ask questions](http://stackoverflow.com/questions/tagged/google-auth-library-php)
about the client or APIs on [StackOverflow](http://stackoverflow.com).
[google-apis-php-client]: https://github.com/google/google-api-php-client
[application default credentials]: https://cloud.google.com/docs/authentication/application-default-credentials
[contributing]: https://github.com/google/google-auth-library-php/tree/main/.github/CONTRIBUTING.md
[copying]: https://github.com/google/google-auth-library-php/tree/main/COPYING
[Guzzle]: https://github.com/guzzle/guzzle
[Guzzle 5]: http://docs.guzzlephp.org/en/5.3
[developer console]: https://console.developers.google.com
[set-up-adc]: https://cloud.google.com/docs/authentication/provide-credentials-adc
================================================
FILE: lib/Google/vendor/google/auth/SECURITY.md
================================================
# Security Policy
To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
================================================
FILE: lib/Google/vendor/google/auth/VERSION
================================================
1.50.0
================================================
FILE: lib/Google/vendor/google/auth/composer.json
================================================
{
"name": "google/auth",
"type": "library",
"description": "Google Auth Library for PHP",
"keywords": ["google", "oauth2", "authentication"],
"homepage": "https://github.com/google/google-auth-library-php",
"license": "Apache-2.0",
"support": {
"docs": "https://cloud.google.com/php/docs/reference/auth/latest"
},
"require": {
"php": "^8.1",
"firebase/php-jwt": "^6.0||^7.0",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.4.5",
"psr/http-message": "^1.1||^2.0",
"psr/cache": "^2.0||^3.0",
"psr/log": "^3.0"
},
"require-dev": {
"guzzlehttp/promises": "^2.0",
"squizlabs/php_codesniffer": "^4.0",
"phpunit/phpunit": "^9.6",
"phpspec/prophecy-phpunit": "^2.1",
"sebastian/comparator": ">=1.2.3",
"phpseclib/phpseclib": "^3.0.35",
"kelvinmo/simplejwt": "^1.1.0",
"webmozart/assert": "^1.11||^2.0",
"symfony/process": "^6.0||^7.0",
"symfony/filesystem": "^6.3||^7.3"
},
"suggest": {
"phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2."
},
"autoload": {
"psr-4": {
"Google\\Auth\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Google\\Auth\\Tests\\": "tests"
}
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/AccessToken.php
================================================
httpHandler = $httpHandler
?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
$this->cache = $cache ?: new MemoryCacheItemPool();
}
/**
* Verifies an id token and returns the authenticated apiLoginTicket.
* Throws an exception if the id token is not valid.
* The audience parameter can be used to control which id tokens are
* accepted. By default, the id token must have been issued to this OAuth2 client.
*
* @param string $token The JSON Web Token to be verified.
* @param array $options [optional] {
* Configuration options.
* @type string $audience The indended recipient of the token.
* @type string $issuer The intended issuer of the token.
* @type string $cacheKey The cache key of the cached certs. Defaults to
* the sha1 of $certsLocation if provided, otherwise is set to
* "federated_signon_certs_v3".
* @type string $certsLocation The location (remote or local) from which
* to retrieve certificates, if not cached. This value should only be
* provided in limited circumstances in which you are sure of the
* behavior.
* @type bool $throwException Whether the function should throw an
* exception if the verification fails. This is useful for
* determining the reason verification failed.
* }
* @return array|false the token payload, if successful, or false if not.
* @throws InvalidArgumentException If certs could not be retrieved from a local file.
* @throws InvalidArgumentException If received certs are in an invalid format.
* @throws InvalidArgumentException If the cert alg is not supported.
* @throws RuntimeException If certs could not be retrieved from a remote location.
* @throws UnexpectedValueException If the token issuer does not match.
* @throws UnexpectedValueException If the token audience does not match.
*/
public function verify($token, array $options = [])
{
$audience = $options['audience'] ?? null;
$issuer = $options['issuer'] ?? null;
$certsLocation = $options['certsLocation'] ?? self::FEDERATED_SIGNON_CERT_URL;
$cacheKey = $options['cacheKey'] ?? $this->getCacheKeyFromCertLocation($certsLocation);
$throwException = $options['throwException'] ?? false; // for backwards compatibility
// Check signature against each available cert.
$certs = $this->getCerts($certsLocation, $cacheKey, $options);
$alg = $this->determineAlg($certs);
if (!in_array($alg, ['RS256', 'ES256'])) {
throw new InvalidArgumentException(
'unrecognized "alg" in certs, expected ES256 or RS256'
);
}
try {
if ($alg == 'RS256') {
return $this->verifyRs256($token, $certs, $audience, $issuer);
}
return $this->verifyEs256($token, $certs, $audience, $issuer);
} catch (ExpiredException $e) { // firebase/php-jwt 5+
} catch (SignatureInvalidException $e) { // firebase/php-jwt 5+
} catch (InvalidTokenException $e) { // simplejwt
} catch (InvalidArgumentException $e) {
} catch (UnexpectedValueException $e) {
}
if ($throwException) {
throw $e;
}
return false;
}
/**
* Identifies the expected algorithm to verify by looking at the "alg" key
* of the provided certs.
*
* @param array $certs Certificate array according to the JWK spec (see
* https://tools.ietf.org/html/rfc7517).
* @return string The expected algorithm, such as "ES256" or "RS256".
*/
private function determineAlg(array $certs)
{
$alg = null;
foreach ($certs as $cert) {
if (empty($cert['alg'])) {
throw new InvalidArgumentException(
'certs expects "alg" to be set'
);
}
$alg = $alg ?: $cert['alg'];
if ($alg != $cert['alg']) {
throw new InvalidArgumentException(
'More than one alg detected in certs'
);
}
}
return $alg;
}
/**
* Verifies an ES256-signed JWT.
*
* @param string $token The JSON Web Token to be verified.
* @param array $certs Certificate array according to the JWK spec (see
* https://tools.ietf.org/html/rfc7517).
* @param string|null $audience If set, returns false if the provided
* audience does not match the "aud" claim on the JWT.
* @param string|null $issuer If set, returns false if the provided
* issuer does not match the "iss" claim on the JWT.
* @return array the token payload, if successful, or false if not.
*/
private function verifyEs256($token, array $certs, $audience = null, $issuer = null)
{
$this->checkSimpleJwt();
$jwkset = new KeySet();
foreach ($certs as $cert) {
$jwkset->add(KeyFactory::create($cert, 'php'));
}
// Validate the signature using the key set and ES256 algorithm.
$jwt = $this->callSimpleJwtDecode([$token, $jwkset, 'ES256']);
$payload = $jwt->getClaims();
if ($audience) {
if (!isset($payload['aud']) || $payload['aud'] != $audience) {
throw new UnexpectedValueException('Audience does not match');
}
}
// @see https://cloud.google.com/iap/docs/signed-headers-howto#verifying_the_jwt_payload
$issuer = $issuer ?: self::IAP_ISSUER;
if (!isset($payload['iss']) || $payload['iss'] !== $issuer) {
throw new UnexpectedValueException('Issuer does not match');
}
return $payload;
}
/**
* Verifies an RS256-signed JWT.
*
* @param string $token The JSON Web Token to be verified.
* @param array $certs Certificate array according to the JWK spec (see
* https://tools.ietf.org/html/rfc7517).
* @param string|null $audience If set, returns false if the provided
* audience does not match the "aud" claim on the JWT.
* @param string|null $issuer If set, returns false if the provided
* issuer does not match the "iss" claim on the JWT.
* @return array the token payload, if successful, or false if not.
*/
private function verifyRs256($token, array $certs, $audience = null, $issuer = null)
{
$this->checkAndInitializePhpsec();
$keys = [];
foreach ($certs as $cert) {
if (empty($cert['kid'])) {
throw new InvalidArgumentException(
'certs expects "kid" to be set'
);
}
if (empty($cert['n']) || empty($cert['e'])) {
throw new InvalidArgumentException(
'RSA certs expects "n" and "e" to be set'
);
}
$publicKey = $this->loadPhpsecPublicKey($cert['n'], $cert['e']);
// create an array of key IDs to certs for the JWT library
$keys[$cert['kid']] = new Key($publicKey, 'RS256');
}
$payload = $this->callJwtStatic('decode', [
$token,
$keys,
]);
if ($audience) {
if (!property_exists($payload, 'aud') || $payload->aud != $audience) {
throw new UnexpectedValueException('Audience does not match');
}
}
// support HTTP and HTTPS issuers
// @see https://developers.google.com/identity/sign-in/web/backend-auth
$issuers = $issuer ? [$issuer] : [self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS];
if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) {
throw new UnexpectedValueException('Issuer does not match');
}
return (array) $payload;
}
/**
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
* token, if a token isn't provided.
*
* @param string|array $token The token (access token or a refresh token) that should be revoked.
* @param array $options [optional] Configuration options.
* @return bool Returns True if the revocation was successful, otherwise False.
*/
public function revoke($token, array $options = [])
{
if (is_array($token)) {
if (isset($token['refresh_token'])) {
$token = $token['refresh_token'];
} else {
$token = $token['access_token'];
}
}
$body = Utils::streamFor(http_build_query(['token' => $token]));
$request = new Request('POST', self::OAUTH2_REVOKE_URI, [
'Cache-Control' => 'no-store',
'Content-Type' => 'application/x-www-form-urlencoded',
], $body);
$httpHandler = $this->httpHandler;
$response = $httpHandler($request, $options);
return $response->getStatusCode() == 200;
}
/**
* Gets federated sign-on certificates to use for verifying identity tokens.
* Returns certs as array structure, where keys are key ids, and values
* are PEM encoded certificates.
*
* @param string $location The location from which to retrieve certs.
* @param string $cacheKey The key under which to cache the retrieved certs.
* @param array $options [optional] Configuration options.
* @return array
* @throws InvalidArgumentException If received certs are in an invalid format.
*/
private function getCerts($location, $cacheKey, array $options = [])
{
$cacheItem = $this->cache->getItem($cacheKey);
$certs = $cacheItem ? $cacheItem->get() : null;
$expireTime = null;
if (!$certs) {
list($certs, $expireTime) = $this->retrieveCertsFromLocation($location, $options);
}
if (!isset($certs['keys'])) {
if ($location !== self::IAP_CERT_URL) {
throw new InvalidArgumentException(
'federated sign-on certs expects "keys" to be set'
);
}
throw new InvalidArgumentException(
'certs expects "keys" to be set'
);
}
// Push caching off until after verifying certs are in a valid format.
// Don't want to cache bad data.
if ($expireTime) {
$cacheItem->expiresAt(new DateTime($expireTime));
$cacheItem->set($certs);
$this->cache->save($cacheItem);
}
return $certs['keys'];
}
/**
* Retrieve and cache a certificates file.
*
* @param string $url location
* @param array $options [optional] Configuration options.
* @return array{array, string}
* @throws InvalidArgumentException If certs could not be retrieved from a local file.
* @throws RuntimeException If certs could not be retrieved from a remote location.
*/
private function retrieveCertsFromLocation($url, array $options = [])
{
// If we're retrieving a local file, just grab it.
$expireTime = '+1 hour';
if (strpos($url, 'http') !== 0) {
if (!file_exists($url)) {
throw new InvalidArgumentException(sprintf(
'Failed to retrieve verification certificates from path: %s.',
$url
));
}
return [
json_decode((string) file_get_contents($url), true),
$expireTime
];
}
$httpHandler = $this->httpHandler;
$response = $httpHandler(new Request('GET', $url), $options);
if ($response->getStatusCode() == 200) {
if ($cacheControl = $response->getHeaderLine('Cache-Control')) {
array_map(function ($value) use (&$expireTime) {
list($key, $value) = explode('=', $value) + [null, null];
if (trim($key) == 'max-age') {
$expireTime = '+' . $value . ' seconds';
}
}, explode(',', $cacheControl));
}
return [
json_decode((string) $response->getBody(), true),
$expireTime
];
}
throw new RuntimeException(sprintf(
'Failed to retrieve verification certificates: "%s".',
$response->getBody()->getContents()
), $response->getStatusCode());
}
/**
* @return void
*/
private function checkAndInitializePhpsec()
{
if (!class_exists(RSA::class)) {
throw new RuntimeException('Please require phpseclib/phpseclib v3 to use this utility.');
}
}
/**
* @return string
* @throws TypeError If the key cannot be initialized to a string.
*/
private function loadPhpsecPublicKey(string $modulus, string $exponent): string
{
$key = PublicKeyLoader::load([
'n' => new BigInteger($this->callJwtStatic('urlsafeB64Decode', [
$modulus,
]), 256),
'e' => new BigInteger($this->callJwtStatic('urlsafeB64Decode', [
$exponent
]), 256),
]);
$formattedPublicKey = $key->toString('PKCS8');
if (!is_string($formattedPublicKey)) {
throw new TypeError('Failed to initialize the key');
}
return $formattedPublicKey;
}
/**
* @return void
*/
private function checkSimpleJwt()
{
// @codeCoverageIgnoreStart
if (!class_exists(SimpleJwt::class)) {
throw new RuntimeException('Please require kelvinmo/simplejwt ^0.2 to use this utility.');
}
// @codeCoverageIgnoreEnd
}
/**
* Provide a hook to mock calls to the JWT static methods.
*
* @param string $method
* @param array $args
* @return mixed
*/
protected function callJwtStatic($method, array $args = [])
{
return call_user_func_array([JWT::class, $method], $args); // @phpstan-ignore-line
}
/**
* Provide a hook to mock calls to the JWT static methods.
*
* @param array $args
* @return mixed
*/
protected function callSimpleJwtDecode(array $args = [])
{
return call_user_func_array([SimpleJwt::class, 'decode'], $args);
}
/**
* Generate a cache key based on the cert location using sha1 with the
* exception of using "federated_signon_certs_v3" to preserve BC.
*
* @param string $certsLocation
* @return string
*/
private function getCacheKeyFromCertLocation($certsLocation)
{
$key = $certsLocation === self::FEDERATED_SIGNON_CERT_URL
? 'federated_signon_certs_v3'
: sha1($certsLocation);
return 'google_auth_certs_cache|' . $key;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/ApplicationDefaultCredentials.php
================================================
push($middleware);
*
* $client = new Client([
* 'handler' => $stack,
* 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
* 'auth' => 'google_auth' // authorize all requests
* ]);
*
* $res = $client->get('myproject/taskqueues/myqueue');
* ```
*/
class ApplicationDefaultCredentials
{
private const SDK_DEBUG_ENV_VAR = 'GOOGLE_SDK_PHP_LOGGING';
/**
* @deprecated
*
* Obtains an AuthTokenSubscriber that uses the default FetchAuthTokenInterface
* implementation to use in this environment.
*
* If supplied, $scope is used to in creating the credentials instance if
* this does not fallback to the compute engine defaults.
*
* @param string|string[] $scope the scope of the access request, expressed
* either as an Array or as a space-delimited String.
* @param callable|null $httpHandler callback which delivers psr7 request
* @param array|null $cacheConfig configuration for the cache when it's present
* @param CacheItemPoolInterface|null $cache A cache implementation, may be
* provided if you have one already available for use.
* @return AuthTokenSubscriber
* @throws DomainException if no implementation can be obtained.
*/
public static function getSubscriber(// @phpstan-ignore-line
$scope = null,
?callable $httpHandler = null,
?array $cacheConfig = null,
?CacheItemPoolInterface $cache = null
) {
$creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache);
/** @phpstan-ignore-next-line */
return new AuthTokenSubscriber($creds, $httpHandler);
}
/**
* Obtains an AuthTokenMiddleware that uses the default FetchAuthTokenInterface
* implementation to use in this environment.
*
* If supplied, $scope is used to in creating the credentials instance if
* this does not fallback to the compute engine defaults.
*
* @param string|string[] $scope the scope of the access request, expressed
* either as an Array or as a space-delimited String.
* @param callable|null $httpHandler callback which delivers psr7 request
* @param array|null $cacheConfig configuration for the cache when it's present
* @param CacheItemPoolInterface|null $cache A cache implementation, may be
* provided if you have one already available for use.
* @param string $quotaProject specifies a project to bill for access
* charges associated with the request.
* @return AuthTokenMiddleware
* @throws DomainException if no implementation can be obtained.
*/
public static function getMiddleware(
$scope = null,
?callable $httpHandler = null,
?array $cacheConfig = null,
?CacheItemPoolInterface $cache = null,
$quotaProject = null
) {
$creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache, $quotaProject);
return new AuthTokenMiddleware($creds, $httpHandler);
}
/**
* Obtains the default FetchAuthTokenInterface implementation to use
* in this environment.
*
* @param string|string[] $scope the scope of the access request, expressed
* either as an Array or as a space-delimited String.
* @param callable|null $httpHandler callback which delivers psr7 request
* @param array|null $cacheConfig configuration for the cache when it's present
* @param CacheItemPoolInterface|null $cache A cache implementation, may be
* provided if you have one already available for use.
* @param string|null $quotaProject specifies a project to bill for access
* charges associated with the request.
* @param string|string[]|null $defaultScope The default scope to use if no
* user-defined scopes exist, expressed either as an Array or as a
* space-delimited string.
* @param string|null $universeDomain Specifies a universe domain to use for the
* calling client library.
* @param null|false|LoggerInterface $logger A PSR3 compliant LoggerInterface.
*
* @return FetchAuthTokenInterface
* @throws DomainException if no implementation can be obtained.
*/
public static function getCredentials(
$scope = null,
?callable $httpHandler = null,
?array $cacheConfig = null,
?CacheItemPoolInterface $cache = null,
$quotaProject = null,
$defaultScope = null,
?string $universeDomain = null,
null|false|LoggerInterface $logger = null,
) {
$creds = null;
$jsonKey = CredentialsLoader::fromEnv()
?: CredentialsLoader::fromWellKnownFile();
$anyScope = $scope ?: $defaultScope;
if (!$httpHandler) {
if (!($client = HttpClientCache::getHttpClient())) {
$client = new Client();
HttpClientCache::setHttpClient($client);
}
$httpHandler = HttpHandlerFactory::build($client, $logger);
}
if (is_null($quotaProject)) {
// if a quota project isn't specified, try to get one from the env var
$quotaProject = CredentialsLoader::quotaProjectFromEnv();
}
if (!is_null($jsonKey)) {
if ($quotaProject) {
$jsonKey['quota_project_id'] = $quotaProject;
}
if ($universeDomain) {
$jsonKey['universe_domain'] = $universeDomain;
}
$creds = CredentialsLoader::makeCredentials(
$scope,
$jsonKey,
$defaultScope
);
} elseif (AppIdentityCredentials::onAppEngine() && !GCECredentials::onAppEngineFlexible()) {
$creds = new AppIdentityCredentials($anyScope);
} elseif (self::onGce($httpHandler, $cacheConfig, $cache)) {
$creds = new GCECredentials(null, $anyScope, null, $quotaProject, null, $universeDomain);
$creds->setIsOnGce(true); // save the credentials a trip to the metadata server
}
if (is_null($creds)) {
throw new DomainException(self::notFound());
}
if (!is_null($cache)) {
$creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache);
}
return $creds;
}
/**
* Obtains an AuthTokenMiddleware which will fetch an ID token to use in the
* Authorization header. The middleware is configured with the default
* FetchAuthTokenInterface implementation to use in this environment.
*
* If supplied, $targetAudience is used to set the "aud" on the resulting
* ID token.
*
* @param string $targetAudience The audience for the ID token.
* @param callable|null $httpHandler callback which delivers psr7 request
* @param array|null $cacheConfig configuration for the cache when it's present
* @param CacheItemPoolInterface|null $cache A cache implementation, may be
* provided if you have one already available for use.
* @return AuthTokenMiddleware
* @throws DomainException if no implementation can be obtained.
*/
public static function getIdTokenMiddleware(
$targetAudience,
?callable $httpHandler = null,
?array $cacheConfig = null,
?CacheItemPoolInterface $cache = null
) {
$creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache);
return new AuthTokenMiddleware($creds, $httpHandler);
}
/**
* Obtains an ProxyAuthTokenMiddleware which will fetch an ID token to use in the
* Authorization header. The middleware is configured with the default
* FetchAuthTokenInterface implementation to use in this environment.
*
* If supplied, $targetAudience is used to set the "aud" on the resulting
* ID token.
*
* @param string $targetAudience The audience for the ID token.
* @param callable|null $httpHandler callback which delivers psr7 request
* @param array|null $cacheConfig configuration for the cache when it's present
* @param CacheItemPoolInterface|null $cache A cache implementation, may be
* provided if you have one already available for use.
* @return ProxyAuthTokenMiddleware
* @throws DomainException if no implementation can be obtained.
*/
public static function getProxyIdTokenMiddleware(
$targetAudience,
?callable $httpHandler = null,
?array $cacheConfig = null,
?CacheItemPoolInterface $cache = null
) {
$creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache);
return new ProxyAuthTokenMiddleware($creds, $httpHandler);
}
/**
* Obtains the default FetchAuthTokenInterface implementation to use
* in this environment, configured with a $targetAudience for fetching an ID
* token.
*
* @param string $targetAudience The audience for the ID token.
* @param callable|null $httpHandler callback which delivers psr7 request
* @param array|null $cacheConfig configuration for the cache when it's present
* @param CacheItemPoolInterface|null $cache A cache implementation, may be
* provided if you have one already available for use.
* @return FetchAuthTokenInterface
* @throws DomainException if no implementation can be obtained.
* @throws InvalidArgumentException if JSON "type" key is invalid
*/
public static function getIdTokenCredentials(
$targetAudience,
?callable $httpHandler = null,
?array $cacheConfig = null,
?CacheItemPoolInterface $cache = null
) {
$creds = null;
$jsonKey = CredentialsLoader::fromEnv()
?: CredentialsLoader::fromWellKnownFile();
if (!$httpHandler) {
if (!($client = HttpClientCache::getHttpClient())) {
$client = new Client();
HttpClientCache::setHttpClient($client);
}
$httpHandler = HttpHandlerFactory::build($client);
}
if (!is_null($jsonKey)) {
if (!array_key_exists('type', $jsonKey)) {
throw new \InvalidArgumentException('json key is missing the type field');
}
$creds = match ($jsonKey['type']) {
'authorized_user' => new UserRefreshCredentials(null, $jsonKey, $targetAudience),
'impersonated_service_account' => new ImpersonatedServiceAccountCredentials(null, $jsonKey, $targetAudience),
'service_account' => new ServiceAccountCredentials(null, $jsonKey, null, $targetAudience),
default => throw new InvalidArgumentException('invalid value in the type field')
};
} elseif (self::onGce($httpHandler, $cacheConfig, $cache)) {
$creds = new GCECredentials(null, null, $targetAudience);
$creds->setIsOnGce(true); // save the credentials a trip to the metadata server
}
if (is_null($creds)) {
throw new DomainException(self::notFound());
}
if (!is_null($cache)) {
$creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache);
}
return $creds;
}
/**
* Returns a StdOutLogger instance
*
* @internal
*
* @return null|LoggerInterface
*/
public static function getDefaultLogger(): null|LoggerInterface
{
$loggingFlag = getenv(self::SDK_DEBUG_ENV_VAR);
// Env var is not set
if (empty($loggingFlag)) {
return null;
}
$loggingFlag = strtolower($loggingFlag);
// Env Var is not true
if ($loggingFlag !== 'true') {
if ($loggingFlag !== 'false') {
trigger_error('The ' . self::SDK_DEBUG_ENV_VAR . ' is set, but it is set to another value than false or true. Logging is disabled');
}
return null;
}
return new StdOutLogger();
}
/**
* @return string
*/
private static function notFound()
{
$msg = 'Your default credentials were not found. To set up ';
$msg .= 'Application Default Credentials, see ';
$msg .= 'https://cloud.google.com/docs/authentication/external/set-up-adc';
return $msg;
}
/**
* @param callable|null $httpHandler
* @param array|null $cacheConfig
* @param CacheItemPoolInterface|null $cache
* @return bool
*/
private static function onGce(
?callable $httpHandler = null,
?array $cacheConfig = null,
?CacheItemPoolInterface $cache = null
) {
$gceCacheConfig = [];
foreach (['lifetime', 'prefix'] as $key) {
if (isset($cacheConfig['gce_' . $key])) {
$gceCacheConfig[$key] = $cacheConfig['gce_' . $key];
}
}
return (new GCECache($gceCacheConfig, $cache))->onGce($httpHandler);
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Cache/FileSystemCacheItemPool.php
================================================
*/
private array $buffer = [];
/**
* Creates a FileSystemCacheItemPool cache that stores values in local storage
*
* @param string $path The string representation of the path where the cache will store the serialized objects.
*/
public function __construct(string $path)
{
$this->cachePath = $path;
if (is_dir($this->cachePath)) {
return;
}
// Suppress the error for when the directory already exists because of a
// race condition
if (!@mkdir($this->cachePath, 0777, true) && !is_dir($this->cachePath)) {
throw new ErrorException("Cache folder couldn't be created.");
}
}
/**
* {@inheritdoc}
*/
public function getItem(string $key): CacheItemInterface
{
if (!$this->validKey($key)) {
throw new InvalidArgumentException("The key '$key' is not valid. The key should follow the pattern |^[a-zA-Z0-9_\.! ]+$|");
}
$item = new TypedItem($key);
$itemPath = $this->cacheFilePath($key);
if (!file_exists($itemPath)) {
return $item;
}
$serializedItem = file_get_contents($itemPath);
if ($serializedItem === false) {
return $item;
}
$item->set(unserialize($serializedItem));
return $item;
}
/**
* {@inheritdoc}
*
* @return iterable An iterable object containing all the
* A traversable collection of Cache Items keyed by the cache keys of
* each item. A Cache item will be returned for each key, even if that
* key is not found. However, if no keys are specified then an empty
* traversable MUST be returned instead.
*/
public function getItems(array $keys = []): iterable
{
$result = [];
foreach ($keys as $key) {
$result[$key] = $this->getItem($key);
}
return $result;
}
/**
* {@inheritdoc}
*/
public function save(CacheItemInterface $item): bool
{
if (!$this->validKey($item->getKey())) {
return false;
}
$itemPath = $this->cacheFilePath($item->getKey());
$serializedItem = serialize($item->get());
$result = file_put_contents($itemPath, $serializedItem, LOCK_EX);
// 0 bytes write is considered a successful operation
if ($result === false) {
return false;
}
return true;
}
/**
* {@inheritdoc}
*/
public function hasItem(string $key): bool
{
return $this->getItem($key)->isHit();
}
/**
* {@inheritdoc}
*/
public function clear(): bool
{
$this->buffer = [];
if (!is_dir($this->cachePath)) {
return false;
}
$files = scandir($this->cachePath);
if (!$files) {
return false;
}
foreach ($files as $fileName) {
if ($fileName === '.' || $fileName === '..') {
continue;
}
if (!unlink($this->cachePath . '/' . $fileName)) {
return false;
}
}
return true;
}
/**
* {@inheritdoc}
*/
public function deleteItem(string $key): bool
{
if (!$this->validKey($key)) {
throw new InvalidArgumentException("The key '$key' is not valid. The key should follow the pattern |^[a-zA-Z0-9_\.! ]+$|");
}
$itemPath = $this->cacheFilePath($key);
if (!file_exists($itemPath)) {
return true;
}
return unlink($itemPath);
}
/**
* {@inheritdoc}
*/
public function deleteItems(array $keys): bool
{
$result = true;
foreach ($keys as $key) {
if (!$this->deleteItem($key)) {
$result = false;
}
}
return $result;
}
/**
* {@inheritdoc}
*/
public function saveDeferred(CacheItemInterface $item): bool
{
array_push($this->buffer, $item);
return true;
}
/**
* {@inheritdoc}
*/
public function commit(): bool
{
$result = true;
foreach ($this->buffer as $item) {
if (!$this->save($item)) {
$result = false;
}
}
return $result;
}
private function cacheFilePath(string $key): string
{
return $this->cachePath . '/' . $key;
}
private function validKey(string $key): bool
{
return (bool) preg_match('|^[a-zA-Z0-9_\.]+$|', $key);
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Cache/InvalidArgumentException.php
================================================
getItems([$key])); // @phpstan-ignore-line
}
/**
* {@inheritdoc}
*
* @return iterable
* A traversable collection of Cache Items keyed by the cache keys of
* each item. A Cache item will be returned for each key, even if that
* key is not found. However, if no keys are specified then an empty
* traversable MUST be returned instead.
*/
public function getItems(array $keys = []): iterable
{
$items = [];
foreach ($keys as $key) {
$items[$key] = $this->hasItem($key) ? clone $this->items[$key] : new TypedItem($key);
}
return $items;
}
/**
* {@inheritdoc}
*
* @return bool
* True if item exists in the cache, false otherwise.
*/
public function hasItem($key): bool
{
$this->isValidKey($key);
return isset($this->items[$key]) && $this->items[$key]->isHit();
}
/**
* {@inheritdoc}
*
* @return bool
* True if the pool was successfully cleared. False if there was an error.
*/
public function clear(): bool
{
$this->items = [];
$this->deferredItems = [];
return true;
}
/**
* {@inheritdoc}
*
* @return bool
* True if the item was successfully removed. False if there was an error.
*/
public function deleteItem($key): bool
{
return $this->deleteItems([$key]);
}
/**
* {@inheritdoc}
*
* @return bool
* True if the items were successfully removed. False if there was an error.
*/
public function deleteItems(array $keys): bool
{
array_walk($keys, [$this, 'isValidKey']);
foreach ($keys as $key) {
unset($this->items[$key]);
}
return true;
}
/**
* {@inheritdoc}
*
* @return bool
* True if the item was successfully persisted. False if there was an error.
*/
public function save(CacheItemInterface $item): bool
{
$this->items[$item->getKey()] = $item;
return true;
}
/**
* {@inheritdoc}
*
* @return bool
* False if the item could not be queued or if a commit was attempted and failed. True otherwise.
*/
public function saveDeferred(CacheItemInterface $item): bool
{
$this->deferredItems[$item->getKey()] = $item;
return true;
}
/**
* {@inheritdoc}
*
* @return bool
* True if all not-yet-saved items were successfully saved or there were none. False otherwise.
*/
public function commit(): bool
{
foreach ($this->deferredItems as $item) {
$this->save($item);
}
$this->deferredItems = [];
return true;
}
/**
* Determines if the provided key is valid.
*
* @param string $key
* @return bool
* @throws InvalidArgumentException
*/
private function isValidKey($key)
{
$invalidCharacters = '{}()/\\\\@:';
if (!is_string($key) || preg_match("#[$invalidCharacters]#", $key)) {
throw new InvalidArgumentException('The provided key is not valid: ' . var_export($key, true));
}
return true;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Cache/SysVCacheItemPool.php
================================================
*/
private $options;
/**
* @var bool
*/
private $hasLoadedItems = false;
/**
* @var SysvSemaphore|false
*/
private SysvSemaphore|false $semId = false;
/**
* Maintain the process which is currently holding the semaphore to prevent deadlock.
*
* @var int|null
*/
private ?int $lockOwnerPid = null;
/**
* Create a SystemV shared memory based CacheItemPool.
*
* @param array $options {
* [optional] Configuration options.
*
* @type int $variableKey The variable key for getting the data from the shared memory. **Defaults to** 1.
* @type string $proj The project identifier for ftok. This needs to be a one character string.
* **Defaults to** 'A'.
* @type string $semProj The project identifier for ftok to provide to `sem_get`. This needs to be a one
* character string.
* **Defaults to** 'B'.
* @type int $memsize The memory size in bytes for shm_attach. **Defaults to** 10000.
* @type int $perm The permission for shm_attach. **Defaults to** 0600.
* }
*/
public function __construct($options = [])
{
if (!extension_loaded('sysvshm')) {
throw new \RuntimeException(
'sysvshm extension is required to use this ItemPool'
);
}
$this->options = $options + [
'variableKey' => self::VAR_KEY,
'proj' => self::DEFAULT_PROJ,
'semProj' => self::DEFAULT_SEM_PROJ,
'memsize' => self::DEFAULT_MEMSIZE,
'perm' => self::DEFAULT_PERM
];
$this->items = [];
$this->deferredItems = [];
$this->sysvKey = ftok(__FILE__, $this->options['proj']);
// gracefully handle when `sysvsem` isn't loaded
// @TODO(v2): throw an exception when the extension isn't loaded
if (extension_loaded('sysvsem')) {
$semKey = ftok(__FILE__, $this->options['semProj']);
$this->semId = sem_get($semKey, 1, $this->options['perm'], true);
}
}
/**
* @param mixed $key
* @return CacheItemInterface
*/
public function getItem($key): CacheItemInterface
{
$this->loadItems();
return current($this->getItems([$key])); // @phpstan-ignore-line
}
/**
* @param array $keys
* @return iterable
*/
public function getItems(array $keys = []): iterable
{
$this->loadItems();
$items = [];
foreach ($keys as $key) {
$items[$key] = $this->hasItem($key) ?
clone $this->items[$key] :
new TypedItem($key);
}
return $items;
}
/**
* {@inheritdoc}
*/
public function hasItem($key): bool
{
$this->loadItems();
return isset($this->items[$key]) && $this->items[$key]->isHit();
}
/**
* {@inheritdoc}
*/
public function clear(): bool
{
if (!$this->acquireLock()) {
return false;
}
$this->items = [];
$this->deferredItems = [];
$ret = $this->saveCurrentItems();
$this->resetShm();
$this->releaseLock();
return $ret;
}
/**
* {@inheritdoc}
*/
public function deleteItem($key): bool
{
return $this->deleteItems([$key]);
}
/**
* {@inheritdoc}
*/
public function deleteItems(array $keys): bool
{
if (!$this->acquireLock()) {
return false;
}
if (!$this->hasLoadedItems) {
$this->loadItems();
}
foreach ($keys as $key) {
unset($this->items[$key]);
}
$ret = $this->saveCurrentItems();
$this->resetShm();
$this->releaseLock();
return $ret;
}
/**
* {@inheritdoc}
*/
public function save(CacheItemInterface $item): bool
{
if (!$this->acquireLock()) {
return false;
}
if (!$this->hasLoadedItems) {
$this->loadItems();
}
$this->items[$item->getKey()] = $item;
$ret = $this->saveCurrentItems();
$this->releaseLock();
return $ret;
}
/**
* {@inheritdoc}
*/
public function saveDeferred(CacheItemInterface $item): bool
{
$this->deferredItems[$item->getKey()] = $item;
return true;
}
/**
* {@inheritdoc}
*/
public function commit(): bool
{
if (!$this->acquireLock()) {
return false;
}
foreach ($this->deferredItems as $item) {
if ($this->save($item) === false) {
$this->releaseLock();
return false;
}
}
$this->deferredItems = [];
$this->releaseLock();
return true;
}
/**
* Save the current items.
*
* @return bool true when success, false upon failure
*/
private function saveCurrentItems()
{
if (!$this->acquireLock()) {
return false;
}
if (false !== $shmid = $this->attachShm()) {
$success = shm_put_var(
$shmid,
$this->options['variableKey'],
$this->items
);
shm_detach($shmid);
$this->releaseLock();
return $success;
}
$this->releaseLock();
return false;
}
/**
* Load the items from the shared memory.
*
* @return bool true when success, false upon failure
*/
private function loadItems()
{
if (!$this->acquireLock()) {
return false;
}
if (false !== $shmid = $this->attachShm()) {
$data = @shm_get_var($shmid, $this->options['variableKey']);
$this->items = $data ?: [];
shm_detach($shmid);
$this->hasLoadedItems = true;
$this->releaseLock();
return true;
}
$this->releaseLock();
return false;
}
private function acquireLock(): bool
{
if ($this->semId === false) {
// if `sysvsem` isn't loaded, or if `sem_get` fails, return true
// this ensures BC with previous versions of the auth library.
// @TODO consider better handling when `sem_get` fails.
return true;
}
$currentPid = getmypid();
if ($this->lockOwnerPid === $currentPid) {
// We already have the lock
return true;
}
if (sem_acquire($this->semId)) {
$this->lockOwnerPid = (int) $currentPid;
return true;
}
return false;
}
private function releaseLock(): bool
{
if ($this->semId === false || $this->lockOwnerPid !== getmypid()) {
return true;
}
$this->lockOwnerPid = null;
return sem_release($this->semId);
}
private function resetShm(): void
{
// Remove the shared memory segment and semaphore when clearing the cache
$shmid = @shm_attach($this->sysvKey);
if ($shmid !== false) {
@shm_remove($shmid);
@shm_detach($shmid);
}
}
private function attachShm(): SysvSharedMemory|false
{
return shm_attach(
$this->sysvKey,
$this->options['memsize'],
$this->options['perm']
);
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Cache/TypedItem.php
================================================
key = $key;
$this->expiration = null;
}
/**
* {@inheritdoc}
*/
public function getKey(): string
{
return $this->key;
}
/**
* {@inheritdoc}
*/
public function get(): mixed
{
return $this->isHit() ? $this->value : null;
}
/**
* {@inheritdoc}
*/
public function isHit(): bool
{
if (!$this->isHit) {
return false;
}
if ($this->expiration === null) {
return true;
}
return $this->currentTime()->getTimestamp() < $this->expiration->getTimestamp();
}
/**
* {@inheritdoc}
*/
public function set(mixed $value): static
{
$this->isHit = true;
$this->value = $value;
return $this;
}
/**
* {@inheritdoc}
*/
public function expiresAt($expiration): static
{
if ($this->isValidExpiration($expiration)) {
$this->expiration = $expiration;
return $this;
}
$error = sprintf(
'Argument 1 passed to %s::expiresAt() must implement interface DateTimeInterface, %s given',
get_class($this),
gettype($expiration)
);
throw new \TypeError($error);
}
/**
* {@inheritdoc}
*/
public function expiresAfter($time): static
{
if (is_int($time)) {
$this->expiration = $this->currentTime()->add(new \DateInterval("PT{$time}S"));
} elseif ($time instanceof \DateInterval) {
$this->expiration = $this->currentTime()->add($time);
} elseif ($time === null) {
$this->expiration = $time;
} else {
$message = 'Argument 1 passed to %s::expiresAfter() must be an ' .
'instance of DateInterval or of the type integer, %s given';
$error = sprintf($message, get_class($this), gettype($time));
throw new \TypeError($error);
}
return $this;
}
/**
* Determines if an expiration is valid based on the rules defined by PSR6.
*
* @param mixed $expiration
* @return bool
*/
private function isValidExpiration($expiration)
{
if ($expiration === null) {
return true;
}
// We test for two types here due to the fact the DateTimeInterface
// was not introduced until PHP 5.5. Checking for the DateTime type as
// well allows us to support 5.4.
if ($expiration instanceof \DateTimeInterface) {
return true;
}
return false;
}
/**
* @return \DateTime
*/
protected function currentTime()
{
return new \DateTime('now', new \DateTimeZone('UTC'));
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/CacheTrait.php
================================================
*/
private $cacheConfig;
/**
* @var ?CacheItemPoolInterface
*/
private $cache;
/**
* Gets the cached value if it is present in the cache when that is
* available.
*
* @param mixed $k
*
* @return mixed
*/
private function getCachedValue($k)
{
if (is_null($this->cache)) {
return null;
}
$key = $this->getFullCacheKey($k);
if (is_null($key)) {
return null;
}
$cacheItem = $this->cache->getItem($key);
if ($cacheItem->isHit()) {
return $cacheItem->get();
}
}
/**
* Saves the value in the cache when that is available.
*
* @param mixed $k
* @param mixed $v
* @return mixed
*/
private function setCachedValue($k, $v)
{
if (is_null($this->cache)) {
return null;
}
$key = $this->getFullCacheKey($k);
if (is_null($key)) {
return null;
}
$cacheItem = $this->cache->getItem($key);
$cacheItem->set($v);
$cacheItem->expiresAfter($this->cacheConfig['lifetime']);
return $this->cache->save($cacheItem);
}
/**
* @param null|string $key
* @return null|string
*/
private function getFullCacheKey($key)
{
if (is_null($key)) {
return null;
}
$key = ($this->cacheConfig['prefix'] ?? '') . $key;
// ensure we do not have illegal characters
$key = preg_replace('|[^a-zA-Z0-9_\.!]|', '', $key);
// Hash keys if they exceed $maxKeyLength (defaults to 64)
if ($this->maxKeyLength && strlen($key) > $this->maxKeyLength) {
$key = substr(hash('sha256', $key), 0, $this->maxKeyLength);
}
return $key;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/CredentialSource/AwsNativeSource.php
================================================
audience = $audience;
$this->regionalCredVerificationUrl = $regionalCredVerificationUrl;
$this->regionUrl = $regionUrl;
$this->securityCredentialsUrl = $securityCredentialsUrl;
$this->imdsv2SessionTokenUrl = $imdsv2SessionTokenUrl;
}
public function fetchSubjectToken(?callable $httpHandler = null): string
{
if (is_null($httpHandler)) {
$httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient());
}
$headers = [];
if ($this->imdsv2SessionTokenUrl) {
$headers = [
'X-aws-ec2-metadata-token' => self::getImdsV2SessionToken($this->imdsv2SessionTokenUrl, $httpHandler)
];
}
if (!$signingVars = self::getSigningVarsFromEnv()) {
if (!$this->securityCredentialsUrl) {
throw new \LogicException('Unable to get credentials from ENV, and no security credentials URL provided');
}
$signingVars = self::getSigningVarsFromUrl(
$httpHandler,
$this->securityCredentialsUrl,
self::getRoleName($httpHandler, $this->securityCredentialsUrl, $headers),
$headers
);
}
if (!$region = self::getRegionFromEnv()) {
if (!$this->regionUrl) {
throw new \LogicException('Unable to get region from ENV, and no region URL provided');
}
$region = self::getRegionFromUrl($httpHandler, $this->regionUrl, $headers);
}
$url = str_replace('{region}', $region, $this->regionalCredVerificationUrl);
$host = parse_url($url)['host'] ?? '';
// From here we use the signing vars to create the signed request to receive a token
[$accessKeyId, $secretAccessKey, $securityToken] = $signingVars;
$headers = self::getSignedRequestHeaders($region, $host, $accessKeyId, $secretAccessKey, $securityToken);
// Inject x-goog-cloud-target-resource into header
$headers['x-goog-cloud-target-resource'] = $this->audience;
// Format headers as they're expected in the subject token
$formattedHeaders = array_map(
fn ($k, $v) => ['key' => $k, 'value' => $v],
array_keys($headers),
$headers,
);
$request = [
'headers' => $formattedHeaders,
'method' => 'POST',
'url' => $url,
];
return urlencode(json_encode($request) ?: '');
}
/**
* @internal
*/
public static function getImdsV2SessionToken(string $imdsV2Url, callable $httpHandler): string
{
$headers = [
'X-aws-ec2-metadata-token-ttl-seconds' => '21600'
];
$request = new Request(
'PUT',
$imdsV2Url,
$headers
);
$response = $httpHandler($request);
return (string) $response->getBody();
}
/**
* @see http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
*
* @internal
*
* @return array
*/
public static function getSignedRequestHeaders(
string $region,
string $host,
string $accessKeyId,
string $secretAccessKey,
?string $securityToken
): array {
$service = 'sts';
# Create a date for headers and the credential string in ISO-8601 format
$amzdate = gmdate('Ymd\THis\Z');
$datestamp = gmdate('Ymd'); # Date w/o time, used in credential scope
# Create the canonical headers and signed headers. Header names
# must be trimmed and lowercase, and sorted in code point order from
# low to high. Note that there is a trailing \n.
$canonicalHeaders = sprintf("host:%s\nx-amz-date:%s\n", $host, $amzdate);
if ($securityToken) {
$canonicalHeaders .= sprintf("x-amz-security-token:%s\n", $securityToken);
}
# Step 5: Create the list of signed headers. This lists the headers
# in the canonicalHeaders list, delimited with ";" and in alpha order.
# Note: The request can include any headers; $canonicalHeaders and
# $signedHeaders lists those that you want to be included in the
# hash of the request. "Host" and "x-amz-date" are always required.
$signedHeaders = 'host;x-amz-date';
if ($securityToken) {
$signedHeaders .= ';x-amz-security-token';
}
# Step 6: Create payload hash (hash of the request body content). For GET
# requests, the payload is an empty string ("").
$payloadHash = hash('sha256', '');
# Step 7: Combine elements to create canonical request
$canonicalRequest = implode("\n", [
'POST', // method
'/', // canonical URL
self::CRED_VERIFICATION_QUERY, // query string
$canonicalHeaders,
$signedHeaders,
$payloadHash
]);
# ************* TASK 2: CREATE THE STRING TO SIGN*************
# Match the algorithm to the hashing algorithm you use, either SHA-1 or
# SHA-256 (recommended)
$algorithm = 'AWS4-HMAC-SHA256';
$scope = implode('/', [$datestamp, $region, $service, 'aws4_request']);
$stringToSign = implode("\n", [$algorithm, $amzdate, $scope, hash('sha256', $canonicalRequest)]);
# ************* TASK 3: CALCULATE THE SIGNATURE *************
# Create the signing key using the function defined above.
// (done above)
$signingKey = self::getSignatureKey($secretAccessKey, $datestamp, $region, $service);
# Sign the string_to_sign using the signing_key
$signature = bin2hex(self::hmacSign($signingKey, $stringToSign));
# ************* TASK 4: ADD SIGNING INFORMATION TO THE REQUEST *************
# The signing information can be either in a query string value or in
# a header named Authorization. This code shows how to use a header.
# Create authorization header and add to request headers
$authorizationHeader = sprintf(
'%s Credential=%s/%s, SignedHeaders=%s, Signature=%s',
$algorithm,
$accessKeyId,
$scope,
$signedHeaders,
$signature
);
# The request can include any headers, but MUST include "host", "x-amz-date",
# and (for this scenario) "Authorization". "host" and "x-amz-date" must
# be included in the canonical_headers and signed_headers, as noted
# earlier. Order here is not significant.
$headers = [
'host' => $host,
'x-amz-date' => $amzdate,
'Authorization' => $authorizationHeader,
];
if ($securityToken) {
$headers['x-amz-security-token'] = $securityToken;
}
return $headers;
}
/**
* @internal
*/
public static function getRegionFromEnv(): ?string
{
$region = getenv('AWS_REGION');
if (empty($region)) {
$region = getenv('AWS_DEFAULT_REGION');
}
return $region ?: null;
}
/**
* @internal
*
* @param callable $httpHandler
* @param string $regionUrl
* @param array $headers Request headers to send in with the request.
*/
public static function getRegionFromUrl(callable $httpHandler, string $regionUrl, array $headers): string
{
// get the region/zone from the region URL
$regionRequest = new Request('GET', $regionUrl, $headers);
$regionResponse = $httpHandler($regionRequest);
// Remove last character. For example, if us-east-2b is returned,
// the region would be us-east-2.
return substr((string) $regionResponse->getBody(), 0, -1);
}
/**
* @internal
*
* @param callable $httpHandler
* @param string $securityCredentialsUrl
* @param array $headers Request headers to send in with the request.
*/
public static function getRoleName(callable $httpHandler, string $securityCredentialsUrl, array $headers): string
{
// Get the AWS role name
$roleRequest = new Request('GET', $securityCredentialsUrl, $headers);
$roleResponse = $httpHandler($roleRequest);
$roleName = (string) $roleResponse->getBody();
return $roleName;
}
/**
* @internal
*
* @param callable $httpHandler
* @param string $securityCredentialsUrl
* @param array $headers Request headers to send in with the request.
* @return array{string, string, ?string}
*/
public static function getSigningVarsFromUrl(
callable $httpHandler,
string $securityCredentialsUrl,
string $roleName,
array $headers
): array {
// Get the AWS credentials
$credsRequest = new Request(
'GET',
$securityCredentialsUrl . '/' . $roleName,
$headers
);
$credsResponse = $httpHandler($credsRequest);
$awsCreds = json_decode((string) $credsResponse->getBody(), true);
return [
$awsCreds['AccessKeyId'], // accessKeyId
$awsCreds['SecretAccessKey'], // secretAccessKey
$awsCreds['Token'], // token
];
}
/**
* @internal
*
* @return array{string, string, ?string}
*/
public static function getSigningVarsFromEnv(): ?array
{
$accessKeyId = getenv('AWS_ACCESS_KEY_ID');
$secretAccessKey = getenv('AWS_SECRET_ACCESS_KEY');
if ($accessKeyId && $secretAccessKey) {
return [
$accessKeyId,
$secretAccessKey,
getenv('AWS_SESSION_TOKEN') ?: null, // session token (can be null)
];
}
return null;
}
/**
* Gets the unique key for caching
* For AwsNativeSource the values are:
* Imdsv2SessionTokenUrl.SecurityCredentialsUrl.RegionUrl.RegionalCredVerificationUrl
*
* @return string
*/
public function getCacheKey(): string
{
return ($this->imdsv2SessionTokenUrl ?? '') .
'.' . ($this->securityCredentialsUrl ?? '') .
'.' . $this->regionUrl .
'.' . $this->regionalCredVerificationUrl;
}
/**
* Return HMAC hash in binary string
*/
private static function hmacSign(string $key, string $msg): string
{
return hash_hmac('sha256', self::utf8Encode($msg), $key, true);
}
/**
* @TODO add a fallback when mbstring is not available
*/
private static function utf8Encode(string $string): string
{
return (string) mb_convert_encoding($string, 'UTF-8', 'ISO-8859-1');
}
private static function getSignatureKey(
string $key,
string $dateStamp,
string $regionName,
string $serviceName
): string {
$kDate = self::hmacSign(self::utf8Encode('AWS4' . $key), $dateStamp);
$kRegion = self::hmacSign($kDate, $regionName);
$kService = self::hmacSign($kRegion, $serviceName);
$kSigning = self::hmacSign($kService, 'aws4_request');
return $kSigning;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/CredentialSource/ExecutableSource.php
================================================
* OIDC response sample:
* {
* "version": 1,
* "success": true,
* "token_type": "urn:ietf:params:oauth:token-type:id_token",
* "id_token": "HEADER.PAYLOAD.SIGNATURE",
* "expiration_time": 1620433341
* }
*
* SAML2 response sample:
* {
* "version": 1,
* "success": true,
* "token_type": "urn:ietf:params:oauth:token-type:saml2",
* "saml_response": "...",
* "expiration_time": 1620433341
* }
*
* Error response sample:
* {
* "version": 1,
* "success": false,
* "code": "401",
* "message": "Error message."
* }
*
*
* The "expiration_time" field in the JSON response is only required for successful
* responses when an output file was specified in the credential configuration
*
* The auth libraries will populate certain environment variables that will be accessible by the
* executable, such as: GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE, GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE,
* GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE, GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL, and
* GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE.
*/
class ExecutableSource implements ExternalAccountCredentialSourceInterface
{
private const GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES = 'GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES';
private const SAML_SUBJECT_TOKEN_TYPE = 'urn:ietf:params:oauth:token-type:saml2';
private const OIDC_SUBJECT_TOKEN_TYPE1 = 'urn:ietf:params:oauth:token-type:id_token';
private const OIDC_SUBJECT_TOKEN_TYPE2 = 'urn:ietf:params:oauth:token-type:jwt';
private string $command;
private ExecutableHandler $executableHandler;
private ?string $outputFile;
/**
* @param string $command The string command to run to get the subject token.
* @param string|null $outputFile
*/
public function __construct(
string $command,
?string $outputFile,
?ExecutableHandler $executableHandler = null,
) {
$this->command = $command;
$this->outputFile = $outputFile;
$this->executableHandler = $executableHandler ?: new ExecutableHandler();
}
/**
* Gets the unique key for caching
* The format for the cache key is:
* Command.OutputFile
*
* @return ?string
*/
public function getCacheKey(): ?string
{
return $this->command . '.' . $this->outputFile;
}
/**
* @param callable|null $httpHandler unused.
* @return string
* @throws RuntimeException if the executable is not allowed to run.
* @throws ExecutableResponseError if the executable response is invalid.
*/
public function fetchSubjectToken(?callable $httpHandler = null): string
{
// Check if the executable is allowed to run.
if (getenv(self::GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES) !== '1') {
throw new RuntimeException(
'Pluggable Auth executables need to be explicitly allowed to run by '
. 'setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment '
. 'Variable to 1.'
);
}
if (!$executableResponse = $this->getCachedExecutableResponse()) {
// Run the executable.
$exitCode = ($this->executableHandler)($this->command);
$output = $this->executableHandler->getOutput();
// If the exit code is not 0, throw an exception with the output as the error details
if ($exitCode !== 0) {
throw new ExecutableResponseError(
'The executable failed to run'
. ($output ? ' with the following error: ' . $output : '.'),
(string) $exitCode
);
}
$executableResponse = $this->parseExecutableResponse($output);
// Validate expiration.
if (isset($executableResponse['expiration_time']) && time() >= $executableResponse['expiration_time']) {
throw new ExecutableResponseError('Executable response is expired.');
}
}
// Throw error when the request was unsuccessful
if ($executableResponse['success'] === false) {
throw new ExecutableResponseError($executableResponse['message'], (string) $executableResponse['code']);
}
// Return subject token field based on the token type
return $executableResponse['token_type'] === self::SAML_SUBJECT_TOKEN_TYPE
? $executableResponse['saml_response']
: $executableResponse['id_token'];
}
/**
* @return array|null
*/
private function getCachedExecutableResponse(): ?array
{
if (
$this->outputFile
&& file_exists($this->outputFile)
&& !empty(trim($outputFileContents = (string) file_get_contents($this->outputFile)))
) {
try {
$executableResponse = $this->parseExecutableResponse($outputFileContents);
} catch (ExecutableResponseError $e) {
throw new ExecutableResponseError(
'Error in output file: ' . $e->getMessage(),
'INVALID_OUTPUT_FILE'
);
}
if ($executableResponse['success'] === false) {
// If the cached token was unsuccessful, run the executable to get a new one.
return null;
}
if (isset($executableResponse['expiration_time']) && time() >= $executableResponse['expiration_time']) {
// If the cached token is expired, run the executable to get a new one.
return null;
}
return $executableResponse;
}
return null;
}
/**
* @return array
*/
private function parseExecutableResponse(string $response): array
{
$executableResponse = json_decode($response, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new ExecutableResponseError(
'The executable returned an invalid response: ' . $response,
'INVALID_RESPONSE'
);
}
if (!array_key_exists('version', $executableResponse)) {
throw new ExecutableResponseError('Executable response must contain a "version" field.');
}
if (!array_key_exists('success', $executableResponse)) {
throw new ExecutableResponseError('Executable response must contain a "success" field.');
}
// Validate required fields for a successful response.
if ($executableResponse['success']) {
// Validate token type field.
$tokenTypes = [self::SAML_SUBJECT_TOKEN_TYPE, self::OIDC_SUBJECT_TOKEN_TYPE1, self::OIDC_SUBJECT_TOKEN_TYPE2];
if (!isset($executableResponse['token_type'])) {
throw new ExecutableResponseError(
'Executable response must contain a "token_type" field when successful'
);
}
if (!in_array($executableResponse['token_type'], $tokenTypes)) {
throw new ExecutableResponseError(sprintf(
'Executable response "token_type" field must be one of %s.',
implode(', ', $tokenTypes)
));
}
// Validate subject token for SAML and OIDC.
if ($executableResponse['token_type'] === self::SAML_SUBJECT_TOKEN_TYPE) {
if (empty($executableResponse['saml_response'])) {
throw new ExecutableResponseError(sprintf(
'Executable response must contain a "saml_response" field when token_type=%s.',
self::SAML_SUBJECT_TOKEN_TYPE
));
}
} elseif (empty($executableResponse['id_token'])) {
throw new ExecutableResponseError(sprintf(
'Executable response must contain a "id_token" field when '
. 'token_type=%s.',
$executableResponse['token_type']
));
}
// Validate expiration exists when an output file is specified.
if ($this->outputFile) {
if (!isset($executableResponse['expiration_time'])) {
throw new ExecutableResponseError(
'The executable response must contain a "expiration_time" field for successful responses ' .
'when an output_file has been specified in the configuration.'
);
}
}
} else {
// Both code and message must be provided for unsuccessful responses.
if (!array_key_exists('code', $executableResponse)) {
throw new ExecutableResponseError('Executable response must contain a "code" field when unsuccessful.');
}
if (empty($executableResponse['message'])) {
throw new ExecutableResponseError('Executable response must contain a "message" field when unsuccessful.');
}
}
return $executableResponse;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/CredentialSource/FileSource.php
================================================
file = $file;
if ($format === 'json' && is_null($subjectTokenFieldName)) {
throw new InvalidArgumentException(
'subject_token_field_name must be set when format is JSON'
);
}
$this->format = $format;
$this->subjectTokenFieldName = $subjectTokenFieldName;
}
public function fetchSubjectToken(?callable $httpHandler = null): string
{
$contents = file_get_contents($this->file);
if ($this->format === 'json') {
if (!$json = json_decode((string) $contents, true)) {
throw new UnexpectedValueException(
'Unable to decode JSON file'
);
}
if (!isset($json[$this->subjectTokenFieldName])) {
throw new UnexpectedValueException(
'subject_token_field_name not found in JSON file'
);
}
$contents = $json[$this->subjectTokenFieldName];
}
return $contents;
}
/**
* Gets the unique key for caching.
* The format for the cache key one of the following:
* Filename
*
* @return string
*/
public function getCacheKey(): ?string
{
return $this->file;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/CredentialSource/UrlSource.php
================================================
*/
private ?array $headers;
/**
* @param string $url The URL to fetch the subject token from.
* @param string|null $format The format of the token in the response. Can be null or "json".
* @param string|null $subjectTokenFieldName The name of the field containing the token in the response. This is required
* when format is "json".
* @param array|null $headers Request headers to send in with the request to the URL.
*/
public function __construct(
string $url,
?string $format = null,
?string $subjectTokenFieldName = null,
?array $headers = null
) {
$this->url = $url;
if ($format === 'json' && is_null($subjectTokenFieldName)) {
throw new InvalidArgumentException(
'subject_token_field_name must be set when format is JSON'
);
}
$this->format = $format;
$this->subjectTokenFieldName = $subjectTokenFieldName;
$this->headers = $headers;
}
public function fetchSubjectToken(?callable $httpHandler = null): string
{
if (is_null($httpHandler)) {
$httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient());
}
$request = new Request(
'GET',
$this->url,
$this->headers ?: []
);
$response = $httpHandler($request);
$body = (string) $response->getBody();
if ($this->format === 'json') {
if (!$json = json_decode((string) $body, true)) {
throw new UnexpectedValueException(
'Unable to decode JSON response'
);
}
if (!isset($json[$this->subjectTokenFieldName])) {
throw new UnexpectedValueException(
'subject_token_field_name not found in JSON file'
);
}
$body = $json[$this->subjectTokenFieldName];
}
return $body;
}
/**
* Get the cache key for the credentials.
* The format for the cache key is:
* URL
*
* @return ?string
*/
public function getCacheKey(): ?string
{
return $this->url;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Credentials/AppIdentityCredentials.php
================================================
push($middleware);
*
* $client = new Client([
* 'handler' => $stack,
* 'base_uri' => 'https://www.googleapis.com/books/v1',
* 'auth' => 'google_auth'
* ]);
*
* $res = $client->get('volumes?q=Henry+David+Thoreau&country=US');
* ```
*/
class AppIdentityCredentials extends CredentialsLoader implements
SignBlobInterface,
ProjectIdProviderInterface
{
/**
* Result of fetchAuthToken.
*
* @var array
*/
protected $lastReceivedToken;
/**
* Array of OAuth2 scopes to be requested.
*
* @var string[]
*/
private $scope;
/**
* @var string
*/
private $clientName;
/**
* @param string|string[] $scope One or more scopes.
*/
public function __construct($scope = [])
{
$this->scope = is_array($scope) ? $scope : explode(' ', (string) $scope);
}
/**
* Determines if this an App Engine instance, by accessing the
* SERVER_SOFTWARE environment variable (prod) or the APPENGINE_RUNTIME
* environment variable (dev).
*
* @return bool true if this an App Engine Instance, false otherwise
*/
public static function onAppEngine()
{
$appEngineProduction = isset($_SERVER['SERVER_SOFTWARE']) &&
0 === strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine');
if ($appEngineProduction) {
return true;
}
$appEngineDevAppServer = isset($_SERVER['APPENGINE_RUNTIME']) &&
$_SERVER['APPENGINE_RUNTIME'] == 'php';
if ($appEngineDevAppServer) {
return true;
}
return false;
}
/**
* Implements FetchAuthTokenInterface#fetchAuthToken.
*
* Fetches the auth tokens using the AppIdentityService if available.
* As the AppIdentityService uses protobufs to fetch the access token,
* the GuzzleHttp\ClientInterface instance passed in will not be used.
*
* @param callable|null $httpHandler callback which delivers psr7 request
* @return array {
* A set of auth related metadata, containing the following
*
* @type string $access_token
* @type string $expiration_time
* }
*/
public function fetchAuthToken(?callable $httpHandler = null)
{
try {
$this->checkAppEngineContext();
} catch (\Exception $e) {
return [];
}
/** @phpstan-ignore-next-line */
$token = AppIdentityService::getAccessToken($this->scope);
$this->lastReceivedToken = $token;
return $token;
}
/**
* Sign a string using AppIdentityService.
*
* @param string $stringToSign The string to sign.
* @param bool $forceOpenSsl [optional] Does not apply to this credentials
* type.
* @return string The signature, base64-encoded.
* @throws \Exception If AppEngine SDK or mock is not available.
*/
public function signBlob($stringToSign, $forceOpenSsl = false)
{
$this->checkAppEngineContext();
/** @phpstan-ignore-next-line */
return base64_encode(AppIdentityService::signForApp($stringToSign)['signature']);
}
/**
* Get the project ID from AppIdentityService.
*
* Returns null if AppIdentityService is unavailable.
*
* @param callable|null $httpHandler Not used by this type.
* @return string|null
*/
public function getProjectId(?callable $httpHandler = null)
{
try {
$this->checkAppEngineContext();
} catch (\Exception $e) {
return null;
}
/** @phpstan-ignore-next-line */
return AppIdentityService::getApplicationId();
}
/**
* Get the client name from AppIdentityService.
*
* Subsequent calls to this method will return a cached value.
*
* @param callable|null $httpHandler Not used in this implementation.
* @return string
* @throws \Exception If AppEngine SDK or mock is not available.
*/
public function getClientName(?callable $httpHandler = null)
{
$this->checkAppEngineContext();
if (!$this->clientName) {
/** @phpstan-ignore-next-line */
$this->clientName = AppIdentityService::getServiceAccountName();
}
return $this->clientName;
}
/**
* @return array{access_token:string,expires_at:int}|null
*/
public function getLastReceivedToken()
{
if ($this->lastReceivedToken) {
return [
'access_token' => $this->lastReceivedToken['access_token'],
'expires_at' => $this->lastReceivedToken['expiration_time'],
];
}
return null;
}
/**
* Caching is handled by the underlying AppIdentityService, return empty string
* to prevent caching.
*
* @return string
*/
public function getCacheKey()
{
return '';
}
/**
* @return void
*/
private function checkAppEngineContext()
{
if (!self::onAppEngine() || !class_exists('google\appengine\api\app_identity\AppIdentityService')) {
throw new \Exception(
'This class must be run in App Engine, or you must include the AppIdentityService '
. 'mock class defined in tests/mocks/AppIdentityService.php'
);
}
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Credentials/ExternalAccountCredentials.php
================================================
*/
private ?array $lastImpersonatedAccessToken;
private string $universeDomain;
/**
* @param string|string[] $scope The scope of the access request, expressed either as an array
* or as a space-delimited string.
* @param array $jsonKey JSON credentials as an associative array.
*/
public function __construct(
$scope,
array $jsonKey
) {
if (!array_key_exists('type', $jsonKey)) {
throw new InvalidArgumentException('json key is missing the type field');
}
if ($jsonKey['type'] !== self::EXTERNAL_ACCOUNT_TYPE) {
throw new InvalidArgumentException(sprintf(
'expected "%s" type but received "%s"',
self::EXTERNAL_ACCOUNT_TYPE,
$jsonKey['type']
));
}
if (!array_key_exists('token_url', $jsonKey)) {
throw new InvalidArgumentException(
'json key is missing the token_url field'
);
}
if (!array_key_exists('audience', $jsonKey)) {
throw new InvalidArgumentException(
'json key is missing the audience field'
);
}
if (!array_key_exists('subject_token_type', $jsonKey)) {
throw new InvalidArgumentException(
'json key is missing the subject_token_type field'
);
}
if (!array_key_exists('credential_source', $jsonKey)) {
throw new InvalidArgumentException(
'json key is missing the credential_source field'
);
}
$this->serviceAccountImpersonationUrl = $jsonKey['service_account_impersonation_url'] ?? null;
$this->quotaProject = $jsonKey['quota_project_id'] ?? null;
$this->workforcePoolUserProject = $jsonKey['workforce_pool_user_project'] ?? null;
$this->universeDomain = $jsonKey['universe_domain'] ?? GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN;
$this->auth = new OAuth2([
'tokenCredentialUri' => $jsonKey['token_url'],
'audience' => $jsonKey['audience'],
'scope' => $scope,
'subjectTokenType' => $jsonKey['subject_token_type'],
'subjectTokenFetcher' => self::buildCredentialSource($jsonKey),
'additionalOptions' => $this->workforcePoolUserProject
? ['userProject' => $this->workforcePoolUserProject]
: [],
]);
if (!$this->isWorkforcePool() && $this->workforcePoolUserProject) {
throw new InvalidArgumentException(
'workforce_pool_user_project should not be set for non-workforce pool credentials.'
);
}
}
/**
* @param array $jsonKey
*/
private static function buildCredentialSource(array $jsonKey): ExternalAccountCredentialSourceInterface
{
$credentialSource = $jsonKey['credential_source'];
if (isset($credentialSource['file'])) {
return new FileSource(
$credentialSource['file'],
$credentialSource['format']['type'] ?? null,
$credentialSource['format']['subject_token_field_name'] ?? null
);
}
if (
isset($credentialSource['environment_id'])
&& 1 === preg_match('/^aws(\d+)$/', $credentialSource['environment_id'], $matches)
) {
if ($matches[1] !== '1') {
throw new InvalidArgumentException(
"aws version \"$matches[1]\" is not supported in the current build."
);
}
if (!array_key_exists('regional_cred_verification_url', $credentialSource)) {
throw new InvalidArgumentException(
'The regional_cred_verification_url field is required for aws1 credential source.'
);
}
return new AwsNativeSource(
$jsonKey['audience'],
$credentialSource['regional_cred_verification_url'], // $regionalCredVerificationUrl
$credentialSource['region_url'] ?? null, // $regionUrl
$credentialSource['url'] ?? null, // $securityCredentialsUrl
$credentialSource['imdsv2_session_token_url'] ?? null, // $imdsV2TokenUrl
);
}
if (isset($credentialSource['url'])) {
return new UrlSource(
$credentialSource['url'],
$credentialSource['format']['type'] ?? null,
$credentialSource['format']['subject_token_field_name'] ?? null,
$credentialSource['headers'] ?? null,
);
}
if (isset($credentialSource['executable'])) {
if (!array_key_exists('command', $credentialSource['executable'])) {
throw new InvalidArgumentException(
'executable source requires a command to be set in the JSON file.'
);
}
// Build command environment variables
$env = [
'GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE' => $jsonKey['audience'],
'GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE' => $jsonKey['subject_token_type'],
// Always set to 0 because interactive mode is not supported.
'GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE' => '0',
];
if ($outputFile = $credentialSource['executable']['output_file'] ?? null) {
$env['GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE'] = $outputFile;
}
if ($serviceAccountImpersonationUrl = $jsonKey['service_account_impersonation_url'] ?? null) {
// Parse email from URL. The formal looks as follows:
// https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/name@project-id.iam.gserviceaccount.com:generateAccessToken
$regex = '/serviceAccounts\/(?[^:]+):generateAccessToken$/';
if (preg_match($regex, $serviceAccountImpersonationUrl, $matches)) {
$env['GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL'] = $matches['email'];
}
}
$timeoutMs = $credentialSource['executable']['timeout_millis'] ?? null;
return new ExecutableSource(
$credentialSource['executable']['command'],
$outputFile,
$timeoutMs ? new ExecutableHandler($env, $timeoutMs) : new ExecutableHandler($env)
);
}
throw new InvalidArgumentException('Unable to determine credential source from json key.');
}
/**
* @param string $stsToken
* @param callable|null $httpHandler
*
* @return array {
* A set of auth related metadata, containing the following
*
* @type string $access_token
* @type int $expires_at
* }
*/
private function getImpersonatedAccessToken(string $stsToken, ?callable $httpHandler = null): array
{
if (!isset($this->serviceAccountImpersonationUrl)) {
throw new InvalidArgumentException(
'service_account_impersonation_url must be set in JSON credentials.'
);
}
$request = new Request(
'POST',
$this->serviceAccountImpersonationUrl,
[
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $stsToken,
],
(string) json_encode([
'lifetime' => sprintf('%ss', OAuth2::DEFAULT_EXPIRY_SECONDS),
'scope' => explode(' ', $this->auth->getScope()),
]),
);
if (is_null($httpHandler)) {
$httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient());
}
$response = $httpHandler($request);
$body = json_decode((string) $response->getBody(), true);
return [
'access_token' => $body['accessToken'],
'expires_at' => strtotime($body['expireTime']),
];
}
/**
* @param callable|null $httpHandler
* @param array $headers [optional] Metrics headers to be inserted
* into the token endpoint request present.
*
* @return array {
* A set of auth related metadata, containing the following
*
* @type string $access_token
* @type int $expires_at (impersonated service accounts only)
* @type int $expires_in (identity pool only)
* @type string $issued_token_type (identity pool only)
* @type string $token_type (identity pool only)
* }
*/
public function fetchAuthToken(?callable $httpHandler = null, array $headers = [])
{
$stsToken = $this->auth->fetchAuthToken($httpHandler, $headers);
if (isset($this->serviceAccountImpersonationUrl)) {
return $this->lastImpersonatedAccessToken = $this->getImpersonatedAccessToken(
$stsToken['access_token'],
$httpHandler
);
}
return $stsToken;
}
/**
* Get the cache token key for the credentials.
* The cache token key format depends on the type of source
* The format for the cache key one of the following:
* FetcherCacheKey.Scope.[ServiceAccount].[TokenType].[WorkforcePoolUserProject]
* FetcherCacheKey.Audience.[ServiceAccount].[TokenType].[WorkforcePoolUserProject]
*
* @return ?string;
*/
public function getCacheKey(): ?string
{
$scopeOrAudience = $this->auth->getAudience();
if (!$scopeOrAudience) {
$scopeOrAudience = $this->auth->getScope();
}
return $this->auth->getSubjectTokenFetcher()->getCacheKey() .
'.' . $scopeOrAudience .
'.' . ($this->serviceAccountImpersonationUrl ?? '') .
'.' . ($this->auth->getSubjectTokenType() ?? '') .
'.' . ($this->workforcePoolUserProject ?? '');
}
public function getLastReceivedToken()
{
return $this->lastImpersonatedAccessToken ?? $this->auth->getLastReceivedToken();
}
/**
* Get the quota project used for this API request
*
* @return string|null
*/
public function getQuotaProject()
{
return $this->quotaProject;
}
/**
* Get the universe domain used for this API request
*
* @return string
*/
public function getUniverseDomain(): string
{
return $this->universeDomain;
}
/**
* Get the project ID.
*
* @param callable|null $httpHandler Callback which delivers psr7 request
* @param string|null $accessToken The access token to use to sign the blob. If
* provided, saves a call to the metadata server for a new access
* token. **Defaults to** `null`.
* @return string|null
*/
public function getProjectId(?callable $httpHandler = null, ?string $accessToken = null)
{
if (isset($this->projectId)) {
return $this->projectId;
}
$projectNumber = $this->getProjectNumber() ?: $this->workforcePoolUserProject;
if (!$projectNumber) {
return null;
}
if (is_null($httpHandler)) {
$httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient());
}
$url = str_replace(
'UNIVERSE_DOMAIN',
$this->getUniverseDomain(),
sprintf(self::CLOUD_RESOURCE_MANAGER_URL, $projectNumber)
);
if (is_null($accessToken)) {
$accessToken = $this->fetchAuthToken($httpHandler)['access_token'];
}
$request = new Request('GET', $url, ['authorization' => 'Bearer ' . $accessToken]);
$response = $httpHandler($request);
$body = json_decode((string) $response->getBody(), true);
return $this->projectId = $body['projectId'];
}
private function getProjectNumber(): ?string
{
$parts = explode('/', $this->auth->getAudience());
$i = array_search('projects', $parts);
return $parts[$i + 1] ?? null;
}
private function isWorkforcePool(): bool
{
$regex = '#//iam\.googleapis\.com/locations/[^/]+/workforcePools/#';
return preg_match($regex, $this->auth->getAudience()) === 1;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Credentials/GCECredentials.php
================================================
push($middleware);
*
* $client = new Client([
* 'handler' => $stack,
* 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
* 'auth' => 'google_auth'
* ]);
*
* $res = $client->get('myproject/taskqueues/myqueue');
*/
class GCECredentials extends CredentialsLoader implements
SignBlobInterface,
ProjectIdProviderInterface,
GetQuotaProjectInterface
{
use IamSignerTrait;
// phpcs:disable
const cacheKey = 'GOOGLE_AUTH_PHP_GCE';
// phpcs:enable
/**
* The metadata IP address on appengine instances.
*
* The IP is used instead of the domain 'metadata' to avoid slow responses
* when not on Compute Engine.
*/
const METADATA_IP = '169.254.169.254';
/**
* The metadata path of the default token.
*/
const TOKEN_URI_PATH = 'v1/instance/service-accounts/default/token';
/**
* The metadata path of the default id token.
*/
const ID_TOKEN_URI_PATH = 'v1/instance/service-accounts/default/identity';
/**
* The metadata path of the client ID.
*/
const CLIENT_ID_URI_PATH = 'v1/instance/service-accounts/default/email';
/**
* The metadata path of the project ID.
*/
const PROJECT_ID_URI_PATH = 'v1/project/project-id';
/**
* The metadata path of the project ID.
*/
const UNIVERSE_DOMAIN_URI_PATH = 'v1/universe/universe-domain';
/**
* The header whose presence indicates GCE presence.
*/
const FLAVOR_HEADER = 'Metadata-Flavor';
/**
* The Linux file which contains the product name.
*/
private const GKE_PRODUCT_NAME_FILE = '/sys/class/dmi/id/product_name';
/**
* The Windows Registry key path to the product name
*/
private const WINDOWS_REGISTRY_KEY_PATH = 'HKEY_LOCAL_MACHINE\\SYSTEM\\HardwareConfig\\Current\\';
/**
* The Windows registry key name for the product name
*/
private const WINDOWS_REGISTRY_KEY_NAME = 'SystemProductName';
/**
* The Name of the product expected from the windows registry
*/
private const PRODUCT_NAME = 'Google';
private const CRED_TYPE = 'mds';
/**
* Note: the explicit `timeout` and `tries` below is a workaround. The underlying
* issue is that resolving an unknown host on some networks will take
* 20-30 seconds; making this timeout short fixes the issue, but
* could lead to false negatives in the event that we are on GCE, but
* the metadata resolution was particularly slow. The latter case is
* "unlikely" since the expected 4-nines time is about 0.5 seconds.
* This allows us to limit the total ping maximum timeout to 1.5 seconds
* for developer desktop scenarios.
*/
const MAX_COMPUTE_PING_TRIES = 3;
const COMPUTE_PING_CONNECTION_TIMEOUT_S = 0.5;
/**
* Flag used to ensure that the onGCE test is only done once;.
*
* @var bool
*/
private $hasCheckedOnGce = false;
/**
* Flag that stores the value of the onGCE check.
*
* @var bool
*/
private $isOnGce = false;
/**
* Result of fetchAuthToken.
*
* @var array
*/
protected $lastReceivedToken;
/**
* @var string|null
*/
private $clientName;
/**
* @var string|null
*/
private $projectId;
/**
* @var string
*/
private $tokenUri;
/**
* @var string
*/
private $targetAudience;
/**
* @var string|null
*/
private $quotaProject;
/**
* @var string|null
*/
private $serviceAccountIdentity;
/**
* @var string
*/
private ?string $universeDomain;
/**
* @param Iam|null $iam [optional] An IAM instance.
* @param string|string[] $scope [optional] the scope of the access request,
* expressed either as an array or as a space-delimited string.
* @param string $targetAudience [optional] The audience for the ID token.
* @param string $quotaProject [optional] Specifies a project to bill for access
* charges associated with the request.
* @param string $serviceAccountIdentity [optional] Specify a service
* account identity name to use instead of "default".
* @param string|null $universeDomain [optional] Specify a universe domain to use
* instead of fetching one from the metadata server.
*/
public function __construct(
?Iam $iam = null,
$scope = null,
$targetAudience = null,
$quotaProject = null,
$serviceAccountIdentity = null,
?string $universeDomain = null
) {
$this->iam = $iam;
if ($scope && $targetAudience) {
throw new InvalidArgumentException(
'Scope and targetAudience cannot both be supplied'
);
}
$tokenUri = self::getTokenUri($serviceAccountIdentity);
if ($scope) {
if (is_string($scope)) {
$scope = explode(' ', $scope);
}
$scope = implode(',', $scope);
$tokenUri = $tokenUri . '?scopes=' . $scope;
} elseif ($targetAudience) {
$tokenUri = self::getIdTokenUri($serviceAccountIdentity);
$tokenUri = $tokenUri . '?audience=' . $targetAudience;
$this->targetAudience = $targetAudience;
}
$this->tokenUri = $tokenUri;
$this->quotaProject = $quotaProject;
$this->serviceAccountIdentity = $serviceAccountIdentity;
$this->universeDomain = $universeDomain;
}
/**
* The full uri for accessing the default token.
*
* @param string $serviceAccountIdentity [optional] Specify a service
* account identity name to use instead of "default".
* @return string
*/
public static function getTokenUri($serviceAccountIdentity = null)
{
$base = 'http://' . self::METADATA_IP . '/computeMetadata/';
$base .= self::TOKEN_URI_PATH;
if ($serviceAccountIdentity) {
return str_replace(
'/default/',
'/' . $serviceAccountIdentity . '/',
$base
);
}
return $base;
}
/**
* The full uri for accessing the default service account.
*
* @param string $serviceAccountIdentity [optional] Specify a service
* account identity name to use instead of "default".
* @return string
*/
public static function getClientNameUri($serviceAccountIdentity = null)
{
$base = 'http://' . self::METADATA_IP . '/computeMetadata/';
$base .= self::CLIENT_ID_URI_PATH;
if ($serviceAccountIdentity) {
return str_replace(
'/default/',
'/' . $serviceAccountIdentity . '/',
$base
);
}
return $base;
}
/**
* The full uri for accesesing the default identity token.
*
* @param string $serviceAccountIdentity [optional] Specify a service
* account identity name to use instead of "default".
* @return string
*/
private static function getIdTokenUri($serviceAccountIdentity = null)
{
$base = 'http://' . self::METADATA_IP . '/computeMetadata/';
$base .= self::ID_TOKEN_URI_PATH;
if ($serviceAccountIdentity) {
return str_replace(
'/default/',
'/' . $serviceAccountIdentity . '/',
$base
);
}
return $base;
}
/**
* The full uri for accessing the default project ID.
*
* @return string
*/
private static function getProjectIdUri()
{
$base = 'http://' . self::METADATA_IP . '/computeMetadata/';
return $base . self::PROJECT_ID_URI_PATH;
}
/**
* The full uri for accessing the default universe domain.
*
* @return string
*/
private static function getUniverseDomainUri()
{
$base = 'http://' . self::METADATA_IP . '/computeMetadata/';
return $base . self::UNIVERSE_DOMAIN_URI_PATH;
}
/**
* Determines if this an App Engine Flexible instance, by accessing the
* GAE_INSTANCE environment variable.
*
* @return bool true if this an App Engine Flexible Instance, false otherwise
*/
public static function onAppEngineFlexible()
{
return substr((string) getenv('GAE_INSTANCE'), 0, 4) === 'aef-';
}
/**
* Determines if this a GCE instance, by accessing the expected metadata
* host.
* If $httpHandler is not specified a the default HttpHandler is used.
*
* @param callable|null $httpHandler callback which delivers psr7 request
* @return bool True if this a GCEInstance, false otherwise
*/
public static function onGce(?callable $httpHandler = null)
{
$httpHandler = $httpHandler
?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
$checkUri = 'http://' . self::METADATA_IP;
for ($i = 1; $i <= self::MAX_COMPUTE_PING_TRIES; $i++) {
try {
// Comment from: oauth2client/client.py
//
// Note: the explicit `timeout` below is a workaround. The underlying
// issue is that resolving an unknown host on some networks will take
// 20-30 seconds; making this timeout short fixes the issue, but
// could lead to false negatives in the event that we are on GCE, but
// the metadata resolution was particularly slow. The latter case is
// "unlikely".
$resp = $httpHandler(
new Request(
'GET',
$checkUri,
[
self::FLAVOR_HEADER => 'Google',
self::$metricMetadataKey => self::getMetricsHeader('', 'mds')
]
),
['timeout' => self::COMPUTE_PING_CONNECTION_TIMEOUT_S]
);
return $resp->getHeaderLine(self::FLAVOR_HEADER) == 'Google';
} catch (ClientException $e) {
} catch (ServerException $e) {
} catch (RequestException $e) {
} catch (ConnectException $e) {
}
}
if (PHP_OS === 'Windows' || PHP_OS === 'WINNT') {
return self::detectResidencyWindows(
self::WINDOWS_REGISTRY_KEY_PATH . self::WINDOWS_REGISTRY_KEY_NAME
);
}
// Detect GCE residency on Linux
return self::detectResidencyLinux(self::GKE_PRODUCT_NAME_FILE);
}
private static function detectResidencyLinux(string $productNameFile): bool
{
if (file_exists($productNameFile)) {
$productName = trim((string) file_get_contents($productNameFile));
return 0 === strpos($productName, self::PRODUCT_NAME);
}
return false;
}
private static function detectResidencyWindows(string $registryProductKey): bool
{
if (!class_exists(COM::class)) {
// the COM extension must be installed and enabled to detect Windows residency
// see https://www.php.net/manual/en/book.com.php
return false;
}
$shell = new COM('WScript.Shell');
$productName = null;
try {
$productName = $shell->regRead($registryProductKey);
} catch (com_exception) {
// This means that we tried to read a key that doesn't exist on the registry
// which might mean that it is a windows instance that is not on GCE
return false;
}
return 0 === strpos($productName, self::PRODUCT_NAME);
}
/**
* Implements FetchAuthTokenInterface#fetchAuthToken.
*
* Fetches the auth tokens from the GCE metadata host if it is available.
* If $httpHandler is not specified a the default HttpHandler is used.
*
* @param callable|null $httpHandler callback which delivers psr7 request
* @param array $headers [optional] Headers to be inserted
* into the token endpoint request present.
*
* @return array {
* A set of auth related metadata, based on the token type.
*
* @type string $access_token for access tokens
* @type int $expires_in for access tokens
* @type string $token_type for access tokens
* @type string $id_token for ID tokens
* }
* @throws \Exception
*/
public function fetchAuthToken(?callable $httpHandler = null, array $headers = [])
{
$httpHandler = $httpHandler
?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
if (!$this->hasCheckedOnGce) {
$this->isOnGce = self::onGce($httpHandler);
$this->hasCheckedOnGce = true;
}
if (!$this->isOnGce) {
return []; // return an empty array with no access token
}
$response = $this->getFromMetadata(
$httpHandler,
$this->tokenUri,
$this->applyTokenEndpointMetrics($headers, $this->targetAudience ? 'it' : 'at')
);
if ($this->targetAudience) {
return $this->lastReceivedToken = ['id_token' => $response];
}
if (null === $json = json_decode($response, true)) {
throw new \Exception('Invalid JSON response');
}
$json['expires_at'] = time() + $json['expires_in'];
// store this so we can retrieve it later
$this->lastReceivedToken = $json;
return $json;
}
/**
* Returns the Cache Key for the credential token.
* The format for the cache key is:
* TokenURI
*
* @return string
*/
public function getCacheKey()
{
return $this->tokenUri;
}
/**
* @return array|null
*/
public function getLastReceivedToken()
{
if ($this->lastReceivedToken) {
if (array_key_exists('id_token', $this->lastReceivedToken)) {
return $this->lastReceivedToken;
}
return [
'access_token' => $this->lastReceivedToken['access_token'],
'expires_at' => $this->lastReceivedToken['expires_at']
];
}
return null;
}
/**
* Get the client name from GCE metadata.
*
* Subsequent calls will return a cached value.
*
* @param callable|null $httpHandler callback which delivers psr7 request
* @return string
*/
public function getClientName(?callable $httpHandler = null)
{
if ($this->clientName) {
return $this->clientName;
}
$httpHandler = $httpHandler
?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
if (!$this->hasCheckedOnGce) {
$this->isOnGce = self::onGce($httpHandler);
$this->hasCheckedOnGce = true;
}
if (!$this->isOnGce) {
return '';
}
$this->clientName = $this->getFromMetadata(
$httpHandler,
self::getClientNameUri($this->serviceAccountIdentity)
);
return $this->clientName;
}
/**
* Fetch the default Project ID from compute engine.
*
* Returns null if called outside GCE.
*
* @param callable|null $httpHandler Callback which delivers psr7 request
* @return string|null
*/
public function getProjectId(?callable $httpHandler = null)
{
if ($this->projectId) {
return $this->projectId;
}
$httpHandler = $httpHandler
?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
if (!$this->hasCheckedOnGce) {
$this->isOnGce = self::onGce($httpHandler);
$this->hasCheckedOnGce = true;
}
if (!$this->isOnGce) {
return null;
}
$this->projectId = $this->getFromMetadata($httpHandler, self::getProjectIdUri());
return $this->projectId;
}
/**
* Fetch the default universe domain from the metadata server.
*
* @param callable|null $httpHandler Callback which delivers psr7 request
* @return string
*/
public function getUniverseDomain(?callable $httpHandler = null): string
{
if (null !== $this->universeDomain) {
return $this->universeDomain;
}
$httpHandler = $httpHandler
?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
if (!$this->hasCheckedOnGce) {
$this->isOnGce = self::onGce($httpHandler);
$this->hasCheckedOnGce = true;
}
try {
$this->universeDomain = $this->getFromMetadata(
$httpHandler,
self::getUniverseDomainUri()
);
} catch (ClientException $e) {
// If the metadata server exists, but returns a 404 for the universe domain, the auth
// libraries should safely assume this is an older metadata server running in GCU, and
// should return the default universe domain.
if (!$e->hasResponse() || 404 != $e->getResponse()->getStatusCode()) {
throw $e;
}
$this->universeDomain = self::DEFAULT_UNIVERSE_DOMAIN;
}
// We expect in some cases the metadata server will return an empty string for the universe
// domain. In this case, the auth library MUST return the default universe domain.
if ('' === $this->universeDomain) {
$this->universeDomain = self::DEFAULT_UNIVERSE_DOMAIN;
}
return $this->universeDomain;
}
/**
* Fetch the value of a GCE metadata server URI.
*
* @param callable $httpHandler An HTTP Handler to deliver PSR7 requests.
* @param string $uri The metadata URI.
* @param array $headers [optional] If present, add these headers to the token
* endpoint request.
*
* @return string
*/
private function getFromMetadata(callable $httpHandler, $uri, array $headers = [])
{
$resp = $httpHandler(
new Request(
'GET',
$uri,
[self::FLAVOR_HEADER => 'Google'] + $headers
)
);
return (string) $resp->getBody();
}
/**
* Get the quota project used for this API request
*
* @return string|null
*/
public function getQuotaProject()
{
return $this->quotaProject;
}
/**
* Set whether or not we've already checked the GCE environment.
*
* @param bool $isOnGce
*
* @return void
*/
public function setIsOnGce($isOnGce)
{
// Implicitly set hasCheckedGce to true
$this->hasCheckedOnGce = true;
// Set isOnGce
$this->isOnGce = $isOnGce;
}
protected function getCredType(): string
{
return self::CRED_TYPE;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Credentials/IAMCredentials.php
================================================
selector = $selector;
$this->token = $token;
}
/**
* export a callback function which updates runtime metadata.
*
* @return callable updateMetadata function
*/
public function getUpdateMetadataFunc()
{
return [$this, 'updateMetadata'];
}
/**
* Updates metadata with the appropriate header metadata.
*
* @param array $metadata metadata hashmap
* @param string $unusedAuthUri optional auth uri
* @param callable|null $httpHandler callback which delivers psr7 request
* Note: this param is unused here, only included here for
* consistency with other credentials class
*
* @return array updated metadata hashmap
*/
public function updateMetadata(
$metadata,
$unusedAuthUri = null,
?callable $httpHandler = null
) {
$metadata_copy = $metadata;
$metadata_copy[self::SELECTOR_KEY] = $this->selector;
$metadata_copy[self::TOKEN_KEY] = $this->token;
return $metadata_copy;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php
================================================
$jsonKey JSON credential file path or JSON array credentials {
* JSON credentials as an associative array.
*
* @type string $service_account_impersonation_url The URL to the service account
* @type string|FetchAuthTokenInterface $source_credentials The source credentials to impersonate
* @type int $lifetime The lifetime of the impersonated credentials
* @type string[] $delegates The delegates to impersonate
* }
* @param string|null $targetAudience The audience to request an ID token.
* @param string|string[]|null $defaultScope The scopes to be used if no "scopes" field exists
* in the `$jsonKey`.
*/
public function __construct(
string|array|null $scope,
string|array $jsonKey,
private ?string $targetAudience = null,
string|array|null $defaultScope = null,
) {
if (is_string($jsonKey)) {
if (!file_exists($jsonKey)) {
throw new InvalidArgumentException('file does not exist');
}
$json = file_get_contents($jsonKey);
if (!$jsonKey = json_decode((string) $json, true)) {
throw new LogicException('invalid json for auth config');
}
}
if (!array_key_exists('service_account_impersonation_url', $jsonKey)) {
throw new LogicException(
'json key is missing the service_account_impersonation_url field'
);
}
if (!array_key_exists('source_credentials', $jsonKey)) {
throw new LogicException('json key is missing the source_credentials field');
}
$jsonKeyScope = $jsonKey['scopes'] ?? null;
$scope = $scope ?: $jsonKeyScope ?: $defaultScope;
if ($scope && $targetAudience) {
throw new InvalidArgumentException(
'Scope and targetAudience cannot both be supplied'
);
}
if (is_array($jsonKey['source_credentials'])) {
if (!array_key_exists('type', $jsonKey['source_credentials'])) {
throw new InvalidArgumentException('json key source credentials are missing the type field');
}
if (
$targetAudience !== null
&& $jsonKey['source_credentials']['type'] === 'service_account'
) {
// Service account tokens MUST request a scope, and as this token is only used to impersonate
// an ID token, the narrowest scope we can request is `iam`.
$scope = self::IAM_SCOPE;
}
$jsonKey['source_credentials'] = match ($jsonKey['source_credentials']['type'] ?? null) {
// Do not pass $defaultScope to ServiceAccountCredentials
'service_account' => new ServiceAccountCredentials($scope, $jsonKey['source_credentials']),
'authorized_user' => new UserRefreshCredentials($scope, $jsonKey['source_credentials']),
'external_account' => new ExternalAccountCredentials($scope, $jsonKey['source_credentials']),
default => throw new \InvalidArgumentException('invalid value in the type field'),
};
}
$this->targetScope = $scope ?? [];
$this->lifetime = $jsonKey['lifetime'] ?? 3600;
$this->delegates = $jsonKey['delegates'] ?? [];
$this->serviceAccountImpersonationUrl = $jsonKey['service_account_impersonation_url'];
$this->impersonatedServiceAccountName = $this->getImpersonatedServiceAccountNameFromUrl(
$this->serviceAccountImpersonationUrl
);
$this->sourceCredentials = $jsonKey['source_credentials'];
}
/**
* Helper function for extracting the Server Account Name from the URL saved in the account
* credentials file.
*
* @param $serviceAccountImpersonationUrl string URL from "service_account_impersonation_url"
* @return string Service account email or ID.
*/
private function getImpersonatedServiceAccountNameFromUrl(
string $serviceAccountImpersonationUrl
): string {
$fields = explode('/', $serviceAccountImpersonationUrl);
$lastField = end($fields);
$splitter = explode(':', $lastField);
return $splitter[0];
}
/**
* Get the client name from the keyfile
*
* In this implementation, it will return the issuers email from the oauth token.
*
* @param callable|null $unusedHttpHandler not used by this credentials type.
* @return string Token issuer email
*/
public function getClientName(?callable $unusedHttpHandler = null)
{
return $this->impersonatedServiceAccountName;
}
/**
* @param callable|null $httpHandler
*
* @return array {
* A set of auth related metadata, containing the following
*
* @type string $access_token
* @type int $expires_in
* @type string $scope
* @type string $token_type
* @type string $id_token
* }
*/
public function fetchAuthToken(?callable $httpHandler = null)
{
$httpHandler = $httpHandler ?? HttpHandlerFactory::build(HttpClientCache::getHttpClient());
// The FetchAuthTokenInterface technically does not have a "headers" argument, but all of
// the implementations do. Additionally, passing in more parameters than the function has
// defined is allowed in PHP. So we'll just ignore the phpstan error here.
// @phpstan-ignore-next-line
$authToken = $this->sourceCredentials->fetchAuthToken(
$httpHandler,
$this->applyTokenEndpointMetrics([], 'at')
);
$headers = $this->applyTokenEndpointMetrics([
'Content-Type' => 'application/json',
'Cache-Control' => 'no-store',
'Authorization' => sprintf('Bearer %s', $authToken['access_token'] ?? $authToken['id_token']),
], $this->isIdTokenRequest() ? 'it' : 'at');
$body = match ($this->isIdTokenRequest()) {
true => [
'audience' => $this->targetAudience,
'includeEmail' => true,
],
false => [
'scope' => $this->targetScope,
'delegates' => $this->delegates,
'lifetime' => sprintf('%ss', $this->lifetime),
]
};
$url = $this->serviceAccountImpersonationUrl;
if ($this->isIdTokenRequest()) {
$regex = '/serviceAccounts\/(?[^:]+):generateAccessToken$/';
if (!preg_match($regex, $url, $matches)) {
throw new InvalidArgumentException(
'Invalid service account impersonation URL - unable to parse service account email'
);
}
$url = str_replace(
'UNIVERSE_DOMAIN',
$this->getUniverseDomain(),
sprintf(self::ID_TOKEN_IMPERSONATION_URL, $matches['email'])
);
}
$request = new Request(
'POST',
$url,
$headers,
(string) json_encode($body)
);
$response = $httpHandler($request);
$body = json_decode((string) $response->getBody(), true);
return match ($this->isIdTokenRequest()) {
true => ['id_token' => $body['token']],
false => [
'access_token' => $body['accessToken'],
'expires_at' => strtotime($body['expireTime']),
]
};
}
/**
* Returns the Cache Key for the credentials
* The cache key is the same as the UserRefreshCredentials class
*
* @return string
*/
public function getCacheKey()
{
return $this->getFullCacheKey(
$this->serviceAccountImpersonationUrl . $this->sourceCredentials->getCacheKey()
);
}
/**
* @return array
*/
public function getLastReceivedToken()
{
return $this->sourceCredentials->getLastReceivedToken();
}
protected function getCredType(): string
{
return self::CRED_TYPE;
}
private function isIdTokenRequest(): bool
{
return !is_null($this->targetAudience);
}
public function getUniverseDomain(): string
{
return $this->sourceCredentials instanceof GetUniverseDomainInterface
? $this->sourceCredentials->getUniverseDomain()
: self::DEFAULT_UNIVERSE_DOMAIN;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Credentials/InsecureCredentials.php
================================================
''
];
/**
* Fetches the auth token. In this case it returns an empty string.
*
* @param callable|null $httpHandler
* @return array{access_token:string} A set of auth related metadata
*/
public function fetchAuthToken(?callable $httpHandler = null)
{
return $this->token;
}
/**
* Returns the cache key. In this case it returns a null value, disabling
* caching.
*
* @return string|null
*/
public function getCacheKey()
{
return null;
}
/**
* Fetches the last received token. In this case, it returns the same empty string
* auth token.
*
* @return array{access_token:string}
*/
public function getLastReceivedToken()
{
return $this->token;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php
================================================
push($middleware);
*
* $client = new Client([
* 'handler' => $stack,
* 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
* 'auth' => 'google_auth' // authorize all requests
* ]);
*
* $res = $client->get('myproject/taskqueues/myqueue');
*/
class ServiceAccountCredentials extends CredentialsLoader implements
GetQuotaProjectInterface,
SignBlobInterface,
ProjectIdProviderInterface
{
use ServiceAccountSignerTrait;
/**
* Used in observability metric headers
*
* @var string
*/
private const CRED_TYPE = 'sa';
private const IAM_SCOPE = 'https://www.googleapis.com/auth/iam';
/**
* The OAuth2 instance used to conduct authorization.
*
* @var OAuth2
*/
protected $auth;
/**
* The quota project associated with the JSON credentials
*
* @var string
*/
protected $quotaProject;
/**
* @var string|null
*/
protected $projectId;
/**
* @var array|null
*/
private $lastReceivedJwtAccessToken;
/**
* @var bool
*/
private $useJwtAccessWithScope = false;
/**
* @var ServiceAccountJwtAccessCredentials|null
*/
private $jwtAccessCredentials;
/**
* @var string
*/
private string $universeDomain;
/**
* Whether this is an ID token request or an access token request. Used when
* building the metric header.
*/
private bool $isIdTokenRequest = false;
/**
* Create a new ServiceAccountCredentials.
*
* @param string|string[]|null $scope the scope of the access request, expressed
* either as an Array or as a space-delimited String.
* @param string|array $jsonKey JSON credential file path or JSON credentials
* as an associative array
* @param string $sub an email address account to impersonate, in situations when
* the service account has been delegated domain wide access.
* @param string $targetAudience The audience for the ID token.
*/
public function __construct(
$scope,
$jsonKey,
$sub = null,
$targetAudience = null
) {
if (is_string($jsonKey)) {
if (!file_exists($jsonKey)) {
throw new \InvalidArgumentException('file does not exist');
}
$jsonKeyStream = file_get_contents($jsonKey);
if (!$jsonKey = json_decode((string) $jsonKeyStream, true)) {
throw new \LogicException('invalid json for auth config');
}
}
if (!array_key_exists('client_email', $jsonKey)) {
throw new \InvalidArgumentException(
'json key is missing the client_email field'
);
}
if (!array_key_exists('private_key', $jsonKey)) {
throw new \InvalidArgumentException(
'json key is missing the private_key field'
);
}
if (array_key_exists('quota_project_id', $jsonKey)) {
$this->quotaProject = (string) $jsonKey['quota_project_id'];
}
if ($scope && $targetAudience) {
throw new InvalidArgumentException(
'Scope and targetAudience cannot both be supplied'
);
}
$additionalClaims = [];
if ($targetAudience) {
$additionalClaims = ['target_audience' => $targetAudience];
$this->isIdTokenRequest = true;
}
$this->auth = new OAuth2([
'audience' => self::TOKEN_CREDENTIAL_URI,
'issuer' => $jsonKey['client_email'],
'scope' => $scope,
'signingAlgorithm' => 'RS256',
'signingKey' => $jsonKey['private_key'],
'signingKeyId' => $jsonKey['private_key_id'] ?? null,
'sub' => $sub,
'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI,
'additionalClaims' => $additionalClaims,
]);
$this->projectId = $jsonKey['project_id'] ?? null;
$this->universeDomain = $jsonKey['universe_domain'] ?? self::DEFAULT_UNIVERSE_DOMAIN;
}
/**
* When called, the ServiceAccountCredentials will use an instance of
* ServiceAccountJwtAccessCredentials to fetch (self-sign) an access token
* even when only scopes are supplied. Otherwise,
* ServiceAccountJwtAccessCredentials is only called when no scopes and an
* authUrl (audience) is suppled.
*
* @return void
*/
public function useJwtAccessWithScope()
{
$this->useJwtAccessWithScope = true;
}
/**
* @param callable|null $httpHandler
* @param array $headers [optional] Headers to be inserted
* into the token endpoint request present.
*
* @return array {
* A set of auth related metadata, containing the following
*
* @type string $access_token
* @type int $expires_in
* @type string $token_type
* }
*/
public function fetchAuthToken(?callable $httpHandler = null, array $headers = [])
{
if ($this->useSelfSignedJwt()) {
$jwtCreds = $this->createJwtAccessCredentials();
$accessToken = $jwtCreds->fetchAuthToken($httpHandler);
if ($lastReceivedToken = $jwtCreds->getLastReceivedToken()) {
// Keep self-signed JWTs in memory as the last received token
$this->lastReceivedJwtAccessToken = $lastReceivedToken;
}
return $accessToken;
}
if ($this->isIdTokenRequest && $this->getUniverseDomain() !== self::DEFAULT_UNIVERSE_DOMAIN) {
$now = time();
$jwt = Jwt::encode(
[
'iss' => $this->auth->getIssuer(),
'sub' => $this->auth->getIssuer(),
'scope' => self::IAM_SCOPE,
'exp' => ($now + $this->auth->getExpiry()),
'iat' => ($now - OAuth2::DEFAULT_SKEW_SECONDS),
],
$this->auth->getSigningKey(),
$this->auth->getSigningAlgorithm(),
$this->auth->getSigningKeyId()
);
// We create a new instance of Iam each time because the `$httpHandler` might change.
$idToken = (new Iam($httpHandler, $this->getUniverseDomain()))->generateIdToken(
$this->auth->getIssuer(),
$this->auth->getAdditionalClaims()['target_audience'],
$jwt,
$this->applyTokenEndpointMetrics($headers, 'it')
);
return ['id_token' => $idToken];
}
return $this->auth->fetchAuthToken(
$httpHandler,
$this->applyTokenEndpointMetrics($headers, $this->isIdTokenRequest ? 'it' : 'at')
);
}
/**
* Return the Cache Key for the credentials.
* For the cache key format is one of the following:
* ClientEmail.Scope[.Sub]
* ClientEmail.Audience[.Sub]
*
* @return string
*/
public function getCacheKey()
{
$scopeOrAudience = $this->auth->getScope();
if (!$scopeOrAudience) {
$scopeOrAudience = $this->auth->getAudience();
}
$key = $this->auth->getIssuer() . '.' . $scopeOrAudience;
if ($sub = $this->auth->getSub()) {
$key .= '.' . $sub;
}
return $key;
}
/**
* @return array
*/
public function getLastReceivedToken()
{
// If self-signed JWTs are being used, fetch the last received token
// from memory. Else, fetch it from OAuth2
return $this->useSelfSignedJwt()
? $this->lastReceivedJwtAccessToken
: $this->auth->getLastReceivedToken();
}
/**
* Get the project ID from the service account keyfile.
*
* Returns null if the project ID does not exist in the keyfile.
*
* @param callable|null $httpHandler Not used by this credentials type.
* @return string|null
*/
public function getProjectId(?callable $httpHandler = null)
{
return $this->projectId;
}
/**
* Updates metadata with the authorization token.
*
* @param array $metadata metadata hashmap
* @param string $authUri optional auth uri
* @param callable|null $httpHandler callback which delivers psr7 request
* @return array updated metadata hashmap
*/
public function updateMetadata(
$metadata,
$authUri = null,
?callable $httpHandler = null
) {
// scope exists. use oauth implementation
if (!$this->useSelfSignedJwt()) {
return parent::updateMetadata($metadata, $authUri, $httpHandler);
}
$jwtCreds = $this->createJwtAccessCredentials();
if ($this->auth->getScope()) {
// Prefer user-provided "scope" to "audience"
$updatedMetadata = $jwtCreds->updateMetadata($metadata, null, $httpHandler);
} else {
$updatedMetadata = $jwtCreds->updateMetadata($metadata, $authUri, $httpHandler);
}
if ($lastReceivedToken = $jwtCreds->getLastReceivedToken()) {
// Keep self-signed JWTs in memory as the last received token
$this->lastReceivedJwtAccessToken = $lastReceivedToken;
}
return $updatedMetadata;
}
/**
* @return ServiceAccountJwtAccessCredentials
*/
private function createJwtAccessCredentials()
{
if (!$this->jwtAccessCredentials) {
// Create credentials for self-signing a JWT (JwtAccess)
$credJson = [
'private_key' => $this->auth->getSigningKey(),
'client_email' => $this->auth->getIssuer(),
];
$this->jwtAccessCredentials = new ServiceAccountJwtAccessCredentials(
$credJson,
$this->auth->getScope()
);
}
return $this->jwtAccessCredentials;
}
/**
* @param string $sub an email address account to impersonate, in situations when
* the service account has been delegated domain wide access.
* @return void
*/
public function setSub($sub)
{
$this->auth->setSub($sub);
}
/**
* Get the client name from the keyfile.
*
* In this case, it returns the keyfile's client_email key.
*
* @param callable|null $httpHandler Not used by this credentials type.
* @return string
*/
public function getClientName(?callable $httpHandler = null)
{
return $this->auth->getIssuer();
}
/**
* Get the private key from the keyfile.
*
* In this case, it returns the keyfile's private_key key, needed for JWT signing.
*
* @return string
*/
public function getPrivateKey()
{
return $this->auth->getSigningKey();
}
/**
* Get the quota project used for this API request
*
* @return string|null
*/
public function getQuotaProject()
{
return $this->quotaProject;
}
/**
* Get the universe domain configured in the JSON credential.
*
* @return string
*/
public function getUniverseDomain(): string
{
return $this->universeDomain;
}
protected function getCredType(): string
{
return self::CRED_TYPE;
}
/**
* @return bool
*/
private function useSelfSignedJwt()
{
// When a sub is supplied, the user is using domain-wide delegation, which not available
// with self-signed JWTs
if (null !== $this->auth->getSub()) {
// If we are outside the GDU, we can't use domain-wide delegation
if ($this->getUniverseDomain() !== self::DEFAULT_UNIVERSE_DOMAIN) {
throw new \LogicException(sprintf(
'Service Account subject is configured for the credential. Domain-wide ' .
'delegation is not supported in universes other than %s.',
self::DEFAULT_UNIVERSE_DOMAIN
));
}
return false;
}
// Do not use self-signed JWT for ID tokens
if ($this->isIdTokenRequest) {
return false;
}
// When true, ServiceAccountCredentials will always use JwtAccess for access tokens
if ($this->useJwtAccessWithScope) {
return true;
}
// If the universe domain is outside the GDU, use JwtAccess for access tokens
if ($this->getUniverseDomain() !== self::DEFAULT_UNIVERSE_DOMAIN) {
return true;
}
return is_null($this->auth->getScope());
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php
================================================
$jsonKey JSON credential file path or JSON credentials
* as an associative array
* @param string|string[] $scope the scope of the access request, expressed
* either as an Array or as a space-delimited String.
*/
public function __construct($jsonKey, $scope = null)
{
if (is_string($jsonKey)) {
if (!file_exists($jsonKey)) {
throw new \InvalidArgumentException('file does not exist');
}
$jsonKeyStream = file_get_contents($jsonKey);
if (!$jsonKey = json_decode((string) $jsonKeyStream, true)) {
throw new \LogicException('invalid json for auth config');
}
}
if (!array_key_exists('client_email', $jsonKey)) {
throw new \InvalidArgumentException(
'json key is missing the client_email field'
);
}
if (!array_key_exists('private_key', $jsonKey)) {
throw new \InvalidArgumentException(
'json key is missing the private_key field'
);
}
if (array_key_exists('quota_project_id', $jsonKey)) {
$this->quotaProject = (string) $jsonKey['quota_project_id'];
}
$this->auth = new OAuth2([
'issuer' => $jsonKey['client_email'],
'sub' => $jsonKey['client_email'],
'signingAlgorithm' => 'RS256',
'signingKey' => $jsonKey['private_key'],
'scope' => $scope,
]);
$this->projectId = $jsonKey['project_id'] ?? null;
}
/**
* Updates metadata with the authorization token.
*
* @param array $metadata metadata hashmap
* @param string $authUri optional auth uri
* @param callable|null $httpHandler callback which delivers psr7 request
* @return array updated metadata hashmap
*/
public function updateMetadata(
$metadata,
$authUri = null,
?callable $httpHandler = null
) {
$scope = $this->auth->getScope();
if (empty($authUri) && empty($scope)) {
return $metadata;
}
$this->auth->setAudience($authUri);
return parent::updateMetadata($metadata, $authUri, $httpHandler);
}
/**
* Implements FetchAuthTokenInterface#fetchAuthToken.
*
* @param callable|null $httpHandler
*
* @return null|array{access_token:string} A set of auth related metadata
*/
public function fetchAuthToken(?callable $httpHandler = null)
{
$audience = $this->auth->getAudience();
$scope = $this->auth->getScope();
if (empty($audience) && empty($scope)) {
return null;
}
if (!empty($audience) && !empty($scope)) {
throw new \UnexpectedValueException(
'Cannot sign both audience and scope in JwtAccess'
);
}
$access_token = $this->auth->toJwt();
// Set the self-signed access token in OAuth2 for getLastReceivedToken
$this->auth->setAccessToken($access_token);
return [
'access_token' => $access_token,
'expires_in' => $this->auth->getExpiry(),
'token_type' => 'Bearer'
];
}
/**
* Return the cache key for the credentials.
* The format for the Cache Key one of the following:
* ClientEmail.Scope
* ClientEmail.Audience
*
* @return string
*/
public function getCacheKey()
{
$scopeOrAudience = $this->auth->getScope();
if (!$scopeOrAudience) {
$scopeOrAudience = $this->auth->getAudience();
}
return $this->auth->getIssuer() . '.' . $scopeOrAudience;
}
/**
* @return array
*/
public function getLastReceivedToken()
{
return $this->auth->getLastReceivedToken();
}
/**
* Get the project ID from the service account keyfile.
*
* Returns null if the project ID does not exist in the keyfile.
*
* @param callable|null $httpHandler Not used by this credentials type.
* @return string|null
*/
public function getProjectId(?callable $httpHandler = null)
{
return $this->projectId;
}
/**
* Get the client name from the keyfile.
*
* In this case, it returns the keyfile's client_email key.
*
* @param callable|null $httpHandler Not used by this credentials type.
* @return string
*/
public function getClientName(?callable $httpHandler = null)
{
return $this->auth->getIssuer();
}
/**
* Get the private key from the keyfile.
*
* In this case, it returns the keyfile's private_key key, needed for JWT signing.
*
* @return string
*/
public function getPrivateKey()
{
return $this->auth->getSigningKey();
}
/**
* Get the quota project used for this API request
*
* @return string|null
*/
public function getQuotaProject()
{
return $this->quotaProject;
}
protected function getCredType(): string
{
return self::CRED_TYPE;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Credentials/UserRefreshCredentials.php
================================================
$jsonKey JSON credential file path or JSON credentials
* as an associative array
* @param string|null $targetAudience The audience for the ID token.
*/
public function __construct(
$scope,
$jsonKey,
?string $targetAudience = null
) {
if (is_string($jsonKey)) {
if (!file_exists($jsonKey)) {
throw new InvalidArgumentException('file does not exist or is unreadable');
}
$json = file_get_contents($jsonKey);
if (!$jsonKey = json_decode((string) $json, true)) {
throw new LogicException('invalid json for auth config');
}
}
if (!array_key_exists('client_id', $jsonKey)) {
throw new InvalidArgumentException(
'json key is missing the client_id field'
);
}
if (!array_key_exists('client_secret', $jsonKey)) {
throw new InvalidArgumentException(
'json key is missing the client_secret field'
);
}
if (!array_key_exists('refresh_token', $jsonKey)) {
throw new InvalidArgumentException(
'json key is missing the refresh_token field'
);
}
if ($scope && $targetAudience) {
throw new InvalidArgumentException(
'Scope and targetAudience cannot both be supplied'
);
}
$additionalClaims = [];
if ($targetAudience) {
$additionalClaims = ['target_audience' => $targetAudience];
$this->isIdTokenRequest = true;
}
$this->auth = new OAuth2([
'clientId' => $jsonKey['client_id'],
'clientSecret' => $jsonKey['client_secret'],
'refresh_token' => $jsonKey['refresh_token'],
'scope' => $scope,
'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI,
'additionalClaims' => $additionalClaims,
]);
if (array_key_exists('quota_project_id', $jsonKey)) {
$this->quotaProject = (string) $jsonKey['quota_project_id'];
}
}
/**
* @param callable|null $httpHandler
* @param array $headers [optional] Metrics headers to be inserted
* into the token endpoint request present.
* This could be passed from ImersonatedServiceAccountCredentials as it uses
* UserRefreshCredentials as source credentials.
*
* @return array {
* A set of auth related metadata, containing the following
*
* @type string $access_token
* @type int $expires_in
* @type string $scope
* @type string $token_type
* @type string $id_token
* }
*/
public function fetchAuthToken(?callable $httpHandler = null, array $headers = [])
{
return $this->auth->fetchAuthToken(
$httpHandler,
$this->applyTokenEndpointMetrics($headers, $this->isIdTokenRequest ? 'it' : 'at')
);
}
/**
* Return the Cache Key for the credentials.
* The format for the Cache key is one of the following:
* ClientId.Scope
* ClientId.Audience
*
* @return string
*/
public function getCacheKey()
{
$scopeOrAudience = $this->auth->getScope();
if (!$scopeOrAudience) {
$scopeOrAudience = $this->auth->getAudience();
}
return $this->auth->getClientId() . '.' . $scopeOrAudience;
}
/**
* @return array
*/
public function getLastReceivedToken()
{
return $this->auth->getLastReceivedToken();
}
/**
* Get the quota project used for this API request
*
* @return string|null
*/
public function getQuotaProject()
{
return $this->quotaProject;
}
/**
* Get the granted scopes (if they exist) for the last fetched token.
*
* @return string|null
*/
public function getGrantedScope()
{
return $this->auth->getGrantedScope();
}
protected function getCredType(): string
{
return self::CRED_TYPE;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/CredentialsLoader.php
================================================
|null JSON key | null
*/
public static function fromEnv()
{
$path = self::getEnv(self::ENV_VAR);
if (empty($path)) {
return null;
}
if (!file_exists($path)) {
$cause = 'file ' . $path . ' does not exist';
throw new \DomainException(self::unableToReadEnv($cause));
}
$jsonKey = file_get_contents($path);
return json_decode((string) $jsonKey, true);
}
/**
* Load a JSON key from a well known path.
*
* The well known path is OS dependent:
*
* * windows: %APPDATA%/gcloud/application_default_credentials.json
* * others: $HOME/.config/gcloud/application_default_credentials.json
*
* If the file does not exist, this returns null.
*
* @return array|null JSON key | null
*/
public static function fromWellKnownFile()
{
$rootEnv = self::isOnWindows() ? 'APPDATA' : 'HOME';
$path = [self::getEnv($rootEnv)];
if (!self::isOnWindows()) {
$path[] = self::NON_WINDOWS_WELL_KNOWN_PATH_BASE;
}
$path[] = self::WELL_KNOWN_PATH;
$path = implode(DIRECTORY_SEPARATOR, $path);
if (!file_exists($path)) {
return null;
}
$jsonKey = file_get_contents($path);
return json_decode((string) $jsonKey, true);
}
/**
* Create a new Credentials instance.
*
* @deprecated This method is being deprecated because of a potential security risk.
*
* This method does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
*
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to use a credential-type-specific
* method.
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types. Please follow the recommendation
* for that method. For example, if you want to load only service accounts,
* you can create the {@see ServiceAccountCredentials} explicitly:
*
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $creds = new ServiceAccountCredentials($scopes, $json);
* ```
*
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
*
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
*
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
*
* @param string|string[] $scope
* @param array $jsonKey
* @param string|string[] $defaultScope
* @return ServiceAccountCredentials|UserRefreshCredentials|ImpersonatedServiceAccountCredentials|ExternalAccountCredentials
*/
public static function makeCredentials(
$scope,
array $jsonKey,
$defaultScope = null
) {
if (!array_key_exists('type', $jsonKey)) {
throw new \InvalidArgumentException('json key is missing the type field');
}
if ($jsonKey['type'] == 'service_account') {
// Do not pass $defaultScope to ServiceAccountCredentials
return new ServiceAccountCredentials($scope, $jsonKey);
}
if ($jsonKey['type'] == 'authorized_user') {
$anyScope = $scope ?: $defaultScope;
return new UserRefreshCredentials($anyScope, $jsonKey);
}
if ($jsonKey['type'] == 'impersonated_service_account') {
return new ImpersonatedServiceAccountCredentials($scope, $jsonKey, null, $defaultScope);
}
if ($jsonKey['type'] == 'external_account') {
$anyScope = $scope ?: $defaultScope;
return new ExternalAccountCredentials($anyScope, $jsonKey);
}
throw new \InvalidArgumentException('invalid value in the type field');
}
/**
* Create an authorized HTTP Client from an instance of FetchAuthTokenInterface.
*
* @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
* @param array $httpClientOptions (optional) Array of request options to apply.
* @param callable|null $httpHandler (optional) http client to fetch the token.
* @param callable|null $tokenCallback (optional) function to be called when a new token is fetched.
* @return \GuzzleHttp\Client
*/
public static function makeHttpClient(
FetchAuthTokenInterface $fetcher,
array $httpClientOptions = [],
?callable $httpHandler = null,
?callable $tokenCallback = null
) {
$middleware = new Middleware\AuthTokenMiddleware(
$fetcher,
$httpHandler,
$tokenCallback
);
$stack = \GuzzleHttp\HandlerStack::create();
$stack->push($middleware);
return new \GuzzleHttp\Client([
'handler' => $stack,
'auth' => 'google_auth',
] + $httpClientOptions);
}
/**
* Create a new instance of InsecureCredentials.
*
* @return InsecureCredentials
*/
public static function makeInsecureCredentials()
{
return new InsecureCredentials();
}
/**
* Fetch a quota project from the environment variable
* GOOGLE_CLOUD_QUOTA_PROJECT. Return null if
* GOOGLE_CLOUD_QUOTA_PROJECT is not specified.
*
* @return string|null
*/
public static function quotaProjectFromEnv()
{
return self::getEnv(self::QUOTA_PROJECT_ENV_VAR) ?: null;
}
/**
* Gets a callable which returns the default device certification.
*
* @throws UnexpectedValueException
* @return callable|null
*/
public static function getDefaultClientCertSource()
{
if (!$clientCertSourceJson = self::loadDefaultClientCertSourceFile()) {
return null;
}
$clientCertSourceCmd = $clientCertSourceJson['cert_provider_command'];
return function () use ($clientCertSourceCmd) {
$cmd = array_map('escapeshellarg', $clientCertSourceCmd);
exec(implode(' ', $cmd), $output, $returnVar);
if (0 === $returnVar) {
return implode(PHP_EOL, $output);
}
throw new RuntimeException(
'"cert_provider_command" failed with a nonzero exit code'
);
};
}
/**
* Determines whether or not the default device certificate should be loaded.
*
* @return bool
*/
public static function shouldLoadClientCertSource()
{
return filter_var(self::getEnv(self::MTLS_CERT_ENV_VAR), FILTER_VALIDATE_BOOLEAN);
}
/**
* @return array{cert_provider_command:string[]}|null
*/
private static function loadDefaultClientCertSourceFile()
{
$rootEnv = self::isOnWindows() ? 'APPDATA' : 'HOME';
$path = sprintf('%s/%s', self::getEnv($rootEnv), self::MTLS_WELL_KNOWN_PATH);
if (!file_exists($path)) {
return null;
}
$jsonKey = file_get_contents($path);
$clientCertSourceJson = json_decode((string) $jsonKey, true);
if (!$clientCertSourceJson) {
throw new UnexpectedValueException('Invalid client cert source JSON');
}
if (!isset($clientCertSourceJson['cert_provider_command'])) {
throw new UnexpectedValueException(
'cert source requires "cert_provider_command"'
);
}
if (!is_array($clientCertSourceJson['cert_provider_command'])) {
throw new UnexpectedValueException(
'cert source expects "cert_provider_command" to be an array'
);
}
return $clientCertSourceJson;
}
/**
* Get the universe domain from the credential. Defaults to "googleapis.com"
* for all credential types which do not support universe domain.
*
* @return string
*/
public function getUniverseDomain(): string
{
return self::DEFAULT_UNIVERSE_DOMAIN;
}
private static function getEnv(string $env): mixed
{
return getenv($env) ?: $_ENV[$env] ?? null;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/ExecutableHandler/ExecutableHandler.php
================================================
*/
private array $env = [];
private ?string $output = null;
/**
* @param array $env
*/
public function __construct(
array $env = [],
int $timeoutMs = self::DEFAULT_EXECUTABLE_TIMEOUT_MILLIS,
) {
if (!class_exists(Process::class)) {
throw new RuntimeException(sprintf(
'The "symfony/process" package is required to use %s.',
self::class
));
}
$this->env = $env;
$this->timeoutMs = $timeoutMs;
}
/**
* @param string $command
* @return int
*/
public function __invoke(string $command): int
{
$process = Process::fromShellCommandline(
$command,
null,
$this->env,
null,
($this->timeoutMs / 1000)
);
try {
$process->run();
} catch (ProcessTimedOutException $e) {
throw new ExecutableResponseError(
'The executable failed to finish within the timeout specified.',
'TIMEOUT_EXCEEDED'
);
}
$this->output = $process->getOutput() . $process->getErrorOutput();
return $process->getExitCode();
}
public function getOutput(): ?string
{
return $this->output;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/ExecutableHandler/ExecutableResponseError.php
================================================
|null $cacheConfig Configuration for the cache
* @param CacheItemPoolInterface $cache
*/
public function __construct(
FetchAuthTokenInterface $fetcher,
?array $cacheConfig = null,
?CacheItemPoolInterface $cache = null
) {
$this->fetcher = $fetcher;
$this->cache = $cache;
$this->cacheConfig = array_merge([
'lifetime' => 1500,
'prefix' => '',
'cacheUniverseDomain' => $fetcher instanceof Credentials\GCECredentials,
], (array) $cacheConfig);
}
/**
* @return FetchAuthTokenInterface
*/
public function getFetcher()
{
return $this->fetcher;
}
/**
* Implements FetchAuthTokenInterface#fetchAuthToken.
*
* Checks the cache for a valid auth token and fetches the auth tokens
* from the supplied fetcher.
*
* @param callable|null $httpHandler callback which delivers psr7 request
* @return array the response
* @throws \Exception
*/
public function fetchAuthToken(?callable $httpHandler = null)
{
if ($cached = $this->fetchAuthTokenFromCache()) {
return $cached;
}
$auth_token = $this->fetcher->fetchAuthToken($httpHandler);
$this->saveAuthTokenInCache($auth_token);
return $auth_token;
}
/**
* @return string
*/
public function getCacheKey()
{
return $this->getFullCacheKey($this->fetcher->getCacheKey());
}
/**
* @return array|null
*/
public function getLastReceivedToken()
{
return $this->fetcher->getLastReceivedToken();
}
/**
* Get the client name from the fetcher.
*
* @param callable|null $httpHandler An HTTP handler to deliver PSR7 requests.
* @return string
*/
public function getClientName(?callable $httpHandler = null)
{
if (!$this->fetcher instanceof SignBlobInterface) {
throw new \RuntimeException(
'Credentials fetcher does not implement ' .
'Google\Auth\SignBlobInterface'
);
}
return $this->fetcher->getClientName($httpHandler);
}
/**
* Sign a blob using the fetcher.
*
* @param string $stringToSign The string to sign.
* @param bool $forceOpenSsl Require use of OpenSSL for local signing. Does
* not apply to signing done using external services. **Defaults to**
* `false`.
* @return string The resulting signature.
* @throws \RuntimeException If the fetcher does not implement
* `Google\Auth\SignBlobInterface`.
*/
public function signBlob($stringToSign, $forceOpenSsl = false)
{
if (!$this->fetcher instanceof SignBlobInterface) {
throw new \RuntimeException(
'Credentials fetcher does not implement ' .
'Google\Auth\SignBlobInterface'
);
}
// Pass the access token from cache for credentials that sign blobs
// using the IAM API. This saves a call to fetch an access token when a
// cached token exists.
if ($this->fetcher instanceof Credentials\GCECredentials
|| $this->fetcher instanceof Credentials\ImpersonatedServiceAccountCredentials
) {
$cached = $this->fetchAuthTokenFromCache();
$accessToken = $cached['access_token'] ?? null;
return $this->fetcher->signBlob($stringToSign, $forceOpenSsl, $accessToken);
}
return $this->fetcher->signBlob($stringToSign, $forceOpenSsl);
}
/**
* Get the quota project used for this API request from the credentials
* fetcher.
*
* @return string|null
*/
public function getQuotaProject()
{
if ($this->fetcher instanceof GetQuotaProjectInterface) {
return $this->fetcher->getQuotaProject();
}
return null;
}
/**
* Get the Project ID from the fetcher.
*
* @param callable|null $httpHandler Callback which delivers psr7 request
* @return string|null
* @throws \RuntimeException If the fetcher does not implement
* `Google\Auth\ProvidesProjectIdInterface`.
*/
public function getProjectId(?callable $httpHandler = null)
{
if (!$this->fetcher instanceof ProjectIdProviderInterface) {
throw new \RuntimeException(
'Credentials fetcher does not implement ' .
'Google\Auth\ProvidesProjectIdInterface'
);
}
// Pass the access token from cache for credentials that require an
// access token to fetch the project ID. This saves a call to fetch an
// access token when a cached token exists.
if ($this->fetcher instanceof Credentials\ExternalAccountCredentials) {
$cached = $this->fetchAuthTokenFromCache();
$accessToken = $cached['access_token'] ?? null;
return $this->fetcher->getProjectId($httpHandler, $accessToken);
}
return $this->fetcher->getProjectId($httpHandler);
}
/*
* Get the Universe Domain from the fetcher.
*
* @return string
*/
public function getUniverseDomain(): string
{
if ($this->fetcher instanceof GetUniverseDomainInterface) {
if ($this->cacheConfig['cacheUniverseDomain']) {
return $this->getCachedUniverseDomain($this->fetcher);
}
return $this->fetcher->getUniverseDomain();
}
return GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN;
}
/**
* Updates metadata with the authorization token.
*
* @param array $metadata metadata hashmap
* @param string $authUri optional auth uri
* @param callable|null $httpHandler callback which delivers psr7 request
* @return array updated metadata hashmap
* @throws \RuntimeException If the fetcher does not implement
* `Google\Auth\UpdateMetadataInterface`.
*/
public function updateMetadata(
$metadata,
$authUri = null,
?callable $httpHandler = null
) {
if (!$this->fetcher instanceof UpdateMetadataInterface) {
throw new \RuntimeException(
'Credentials fetcher does not implement ' .
'Google\Auth\UpdateMetadataInterface'
);
}
$cached = $this->fetchAuthTokenFromCache($authUri);
if ($cached) {
// Set the access token in the `Authorization` metadata header so
// the downstream call to updateMetadata know they don't need to
// fetch another token.
if (isset($cached['access_token'])) {
$metadata[self::AUTH_METADATA_KEY] = [
'Bearer ' . $cached['access_token']
];
} elseif (isset($cached['id_token'])) {
$metadata[self::AUTH_METADATA_KEY] = [
'Bearer ' . $cached['id_token']
];
}
}
$newMetadata = $this->fetcher->updateMetadata(
$metadata,
$authUri,
$httpHandler
);
if (!$cached && $token = $this->fetcher->getLastReceivedToken()) {
$this->saveAuthTokenInCache($token, $authUri);
}
return $newMetadata;
}
/**
* @param string|null $authUri
* @return array|null
*/
private function fetchAuthTokenFromCache($authUri = null)
{
// Use the cached value if its available.
//
// TODO: correct caching; update the call to setCachedValue to set the expiry
// to the value returned with the auth token.
//
// TODO: correct caching; enable the cache to be cleared.
// if $authUri is set, use it as the cache key
$cacheKey = $authUri
? $this->getFullCacheKey($authUri)
: $this->fetcher->getCacheKey();
$cached = $this->getCachedValue($cacheKey);
if (is_array($cached)) {
if (empty($cached['expires_at'])) {
// If there is no expiration data, assume token is not expired.
// (for JwtAccess and ID tokens)
return $cached;
}
if ((time() + $this->eagerRefreshThresholdSeconds) < $cached['expires_at']) {
// access token is not expired
return $cached;
}
}
return null;
}
/**
* @param array $authToken
* @param string|null $authUri
* @return void
*/
private function saveAuthTokenInCache($authToken, $authUri = null)
{
if (isset($authToken['access_token']) ||
isset($authToken['id_token'])) {
// if $authUri is set, use it as the cache key
$cacheKey = $authUri
? $this->getFullCacheKey($authUri)
: $this->fetcher->getCacheKey();
$this->setCachedValue($cacheKey, $authToken);
}
}
private function getCachedUniverseDomain(GetUniverseDomainInterface $fetcher): string
{
$cacheKey = $this->getFullCacheKey($fetcher->getCacheKey() . 'universe_domain'); // @phpstan-ignore-line
if ($universeDomain = $this->getCachedValue($cacheKey)) {
return $universeDomain;
}
$universeDomain = $fetcher->getUniverseDomain();
$this->setCachedValue($cacheKey, $universeDomain);
return $universeDomain;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/FetchAuthTokenInterface.php
================================================
a hash of auth tokens
*/
public function fetchAuthToken(?callable $httpHandler = null);
/**
* Obtains a key that can used to cache the results of #fetchAuthToken.
*
* If the value is empty, the auth token is not cached.
*
* @return string a key that may be used to cache the auth token.
*/
public function getCacheKey();
/**
* Returns an associative array with the token and
* expiration time.
*
* @return null|array {
* The last received access token.
*
* @type string $access_token The access token string.
* @type int $expires_at The time the token expires as a UNIX timestamp.
* }
*/
public function getLastReceivedToken();
}
================================================
FILE: lib/Google/vendor/google/auth/src/GCECache.php
================================================
$cacheConfig Configuration for the cache
* @param CacheItemPoolInterface $cache
*/
public function __construct(
?array $cacheConfig = null,
?CacheItemPoolInterface $cache = null
) {
$this->cache = $cache;
$this->cacheConfig = array_merge([
'lifetime' => 1500,
'prefix' => '',
], (array) $cacheConfig);
}
/**
* Caches the result of onGce so the metadata server is not called multiple
* times.
*
* @param callable|null $httpHandler callback which delivers psr7 request
* @return bool True if this a GCEInstance, false otherwise
*/
public function onGce(?callable $httpHandler = null)
{
if (is_null($this->cache)) {
return GCECredentials::onGce($httpHandler);
}
$cacheKey = self::GCE_CACHE_KEY;
$onGce = $this->getCachedValue($cacheKey);
if (is_null($onGce)) {
$onGce = GCECredentials::onGce($httpHandler);
$this->setCachedValue($cacheKey, $onGce);
}
return $onGce;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/GetQuotaProjectInterface.php
================================================
client = $client;
$this->logger = $logger;
}
/**
* Accepts a PSR-7 request and an array of options and returns a PSR-7 response.
*
* @param RequestInterface $request
* @param array $options
* @return ResponseInterface
*/
public function __invoke(RequestInterface $request, array $options = [])
{
$requestEvent = null;
if ($this->logger) {
$requestEvent = $this->requestLog($request, $options);
}
$response = $this->client->send($request, $options);
if ($this->logger) {
$this->responseLog($response, $requestEvent);
}
return $response;
}
/**
* Accepts a PSR-7 request and an array of options and returns a PromiseInterface
*
* @param RequestInterface $request
* @param array $options
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function async(RequestInterface $request, array $options = [])
{
$requestEvent = null;
if ($this->logger) {
$requestEvent = $this->requestLog($request, $options);
}
$promise = $this->client->sendAsync($request, $options);
if ($this->logger) {
$promise->then(function (ResponseInterface $response) use ($requestEvent) {
$this->responseLog($response, $requestEvent);
return $response;
});
}
return $promise;
}
/**
* @internal
* @param RequestInterface $request
* @param array $options
*/
public function requestLog(RequestInterface $request, array $options): RpcLogEvent
{
$requestEvent = new RpcLogEvent();
$requestEvent->method = $request->getMethod();
$requestEvent->url = (string) $request->getUri();
$requestEvent->headers = $request->getHeaders();
$requestEvent->payload = $request->getBody()->getContents();
$requestEvent->retryAttempt = $options['retryAttempt'] ?? null;
$requestEvent->serviceName = $options['serviceName'] ?? null;
$requestEvent->processId = (int) getmypid();
$requestEvent->requestId = $options['requestId'] ?? crc32((string) spl_object_id($request) . getmypid());
$this->logRequest($requestEvent);
return $requestEvent;
}
/**
* @internal
*/
public function responseLog(ResponseInterface $response, RpcLogEvent $requestEvent): void
{
$responseEvent = new RpcLogEvent($requestEvent->milliseconds);
$responseEvent->headers = $response->getHeaders();
$responseEvent->payload = $response->getBody()->getContents();
$responseEvent->status = $response->getStatusCode();
$responseEvent->processId = $requestEvent->processId;
$responseEvent->requestId = $requestEvent->requestId;
$this->logResponse($responseEvent);
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/HttpHandler/Guzzle7HttpHandler.php
================================================
remove('http_errors');
$stack->unshift(Middleware::httpErrors($bodySummarizer), 'http_errors');
}
$client = new Client(['handler' => $stack]);
}
$logger = ($logger === false)
? null
: $logger ?? ApplicationDefaultCredentials::getDefaultLogger();
$version = null;
if (defined('GuzzleHttp\ClientInterface::MAJOR_VERSION')) {
$version = ClientInterface::MAJOR_VERSION;
} elseif (defined('GuzzleHttp\ClientInterface::VERSION')) {
$version = (int) substr(ClientInterface::VERSION, 0, 1);
}
switch ($version) {
case 6:
return new Guzzle6HttpHandler($client, $logger);
case 7:
return new Guzzle7HttpHandler($client, $logger);
default:
throw new \Exception('Version not supported');
}
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Iam.php
================================================
httpHandler = $httpHandler
?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
$this->universeDomain = $universeDomain;
}
/**
* Sign a string using the IAM signBlob API.
*
* Note that signing using IAM requires your service account to have the
* `iam.serviceAccounts.signBlob` permission, part of the "Service Account
* Token Creator" IAM role.
*
* @param string $email The service account email.
* @param string $accessToken An access token from the service account.
* @param string $stringToSign The string to be signed.
* @param array $delegates [optional] A list of service account emails to
* add to the delegate chain. If omitted, the value of `$email` will
* be used.
* @return string The signed string, base64-encoded.
*/
public function signBlob($email, $accessToken, $stringToSign, array $delegates = [])
{
$name = sprintf(self::SERVICE_ACCOUNT_NAME, $email);
$apiRoot = str_replace('UNIVERSE_DOMAIN', $this->universeDomain, self::IAM_API_ROOT_TEMPLATE);
$uri = $apiRoot . '/' . sprintf(self::SIGN_BLOB_PATH, $name);
if ($delegates) {
foreach ($delegates as &$delegate) {
$delegate = sprintf(self::SERVICE_ACCOUNT_NAME, $delegate);
}
} else {
$delegates = [$name];
}
$body = [
'delegates' => $delegates,
'payload' => base64_encode($stringToSign),
];
$headers = [
'Authorization' => 'Bearer ' . $accessToken
];
$request = new Psr7\Request(
'POST',
$uri,
$headers,
Utils::streamFor(json_encode($body))
);
$res = ($this->httpHandler)($request);
$body = json_decode((string) $res->getBody(), true);
return $body['signedBlob'];
}
/**
* Sign a string using the IAM signBlob API.
*
* Note that signing using IAM requires your service account to have the
* `iam.serviceAccounts.signBlob` permission, part of the "Service Account
* Token Creator" IAM role.
*
* @param string $clientEmail The service account email.
* @param string $targetAudience The audience for the ID token.
* @param string $bearerToken The token to authenticate the IAM request.
* @param array $headers [optional] Additional headers to send with the request.
*
* @return string The signed string, base64-encoded.
*/
public function generateIdToken(
string $clientEmail,
string $targetAudience,
string $bearerToken,
array $headers = []
): string {
$name = sprintf(self::SERVICE_ACCOUNT_NAME, $clientEmail);
$apiRoot = str_replace('UNIVERSE_DOMAIN', $this->universeDomain, self::IAM_API_ROOT_TEMPLATE);
$uri = $apiRoot . '/' . sprintf(self::GENERATE_ID_TOKEN_PATH, $name);
$headers['Authorization'] = 'Bearer ' . $bearerToken;
$body = [
'audience' => $targetAudience,
'includeEmail' => true,
'useEmailAzp' => true,
];
$request = new Psr7\Request(
'POST',
$uri,
$headers,
Utils::streamFor(json_encode($body))
);
$res = ($this->httpHandler)($request);
$body = json_decode((string) $res->getBody(), true);
return $body['token'];
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/IamSignerTrait.php
================================================
iam;
if (!$signer) {
$signer = $this instanceof GetUniverseDomainInterface
? new Iam($httpHandler, $this->getUniverseDomain())
: new Iam($httpHandler);
}
$email = $this->getClientName($httpHandler);
if (is_null($accessToken)) {
$previousToken = $this->getLastReceivedToken();
$accessToken = $previousToken
? $previousToken['access_token']
: $this->fetchAuthToken($httpHandler)['access_token'];
}
return $signer->signBlob($email, $accessToken, $stringToSign);
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Logging/LoggingTrait.php
================================================
$event->timestamp,
'severity' => strtoupper(LogLevel::DEBUG),
'processId' => $event->processId ?? null,
'requestId' => $event->requestId ?? null,
'rpcName' => $event->rpcName ?? null,
];
$debugEvent = array_filter($debugEvent, fn ($value) => !is_null($value));
$jsonPayload = [
'request.method' => $event->method,
'request.url' => $event->url,
'request.headers' => $event->headers,
'request.payload' => $this->truncatePayload($event->payload),
'request.jwt' => $this->getJwtToken($event->headers ?? []),
'retryAttempt' => $event->retryAttempt
];
// Remove null values
$debugEvent['jsonPayload'] = array_filter($jsonPayload, fn ($value) => !is_null($value));
$stringifiedEvent = json_encode($debugEvent, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
// There was an error stringifying the event, return to not break execution
if ($stringifiedEvent === false) {
return;
}
$this->logger->debug($stringifiedEvent);
}
/**
* @param RpcLogEvent $event
*/
private function logResponse(RpcLogEvent $event): void
{
$debugEvent = [
'timestamp' => $event->timestamp,
'severity' => strtoupper(LogLevel::DEBUG),
'processId' => $event->processId ?? null,
'requestId' => $event->requestId ?? null,
'jsonPayload' => [
'response.status' => $event->status,
'response.headers' => $event->headers,
'response.payload' => $this->truncatePayload($event->payload),
'latencyMillis' => $event->latency,
]
];
// Remove null values
$debugEvent = array_filter($debugEvent, fn ($value) => !is_null($value));
$debugEvent['jsonPayload'] = array_filter(
$debugEvent['jsonPayload'],
fn ($value) => !is_null($value)
);
$stringifiedEvent = json_encode($debugEvent, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
// There was an error stringifying the event, return to not break execution
if ($stringifiedEvent !== false) {
$this->logger->debug($stringifiedEvent);
}
}
/**
* @param array $headers
* @return null|array
*/
private function getJwtToken(array $headers): null|array
{
if (empty($headers)) {
return null;
}
$tokenHeader = $headers['Authorization'] ?? '';
$token = str_replace('Bearer ', '', $tokenHeader);
if (substr_count($token, '.') !== 2) {
return null;
}
[$header, $token, $_] = explode('.', $token);
return [
'header' => base64_decode($header),
'token' => base64_decode($token)
];
}
/**
* @param null|string $payload
* @return string
*/
private function truncatePayload(null|string $payload): null|string
{
$maxLength = 500;
if (is_null($payload) || strlen($payload) <= $maxLength) {
return $payload;
}
return substr($payload, 0, $maxLength) . '...';
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Logging/RpcLogEvent.php
================================================
*/
public null|array $headers = null;
/**
* An array representation of JSON for the response or request
*
* @var null|string
*/
public null|string $payload = null;
/**
* Status code for REST or gRPC methods
*
* @var null|int|string
*/
public null|int|string $status = null;
/**
* The latency in milliseconds
*
* @var null|int
*/
public null|int $latency = null;
/**
* The retry attempt number
*
* @var null|int
*/
public null|int $retryAttempt = null;
/**
* The name of the gRPC method being called
*
* @var null|string
*/
public null|string $rpcName = null;
/**
* The Service Name of the gRPC
*
* @var null|string $serviceName
*/
public null|string $serviceName = null;
/**
* The Process ID for tracing logs
*
* @var null|int $processId
*/
public null|int $processId = null;
/**
* The Request id for tracing logs
*
* @var null|int $requestId;
*/
public null|int $requestId = null;
/**
* Creates an object with all the fields required for logging
* Passing a string representation of a timestamp calculates the difference between
* these two times and sets the latency field with the result.
*
* @param null|float $startTime (Optional) Parameter to calculate the latency
*/
public function __construct(null|float $startTime = null)
{
$this->timestamp = date(DATE_RFC3339);
// Takes the micro time and convets it to millis
$this->milliseconds = round(microtime(true) * 1000);
if ($startTime) {
$this->latency = (int) round($this->milliseconds - $startTime);
}
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Logging/StdOutLogger.php
================================================
*/
private array $levelMapping = [
LogLevel::EMERGENCY => 7,
LogLevel::ALERT => 6,
LogLevel::CRITICAL => 5,
LogLevel::ERROR => 4,
LogLevel::WARNING => 3,
LogLevel::NOTICE => 2,
LogLevel::INFO => 1,
LogLevel::DEBUG => 0,
];
private int $level;
/**
* Constructs a basic PSR-3 logger class that logs into StdOut for GCP Logging
*
* @param string $level The level of the logger instance.
*/
public function __construct(string $level = LogLevel::DEBUG)
{
$this->level = $this->getLevelFromName($level);
}
/**
* {@inheritdoc}
*/
public function log($level, string|Stringable $message, array $context = []): void
{
if ($this->getLevelFromName($level) < $this->level) {
return;
}
print($message . "\n");
}
/**
* @param string $levelName
* @return int
* @throws InvalidArgumentException
*/
private function getLevelFromName(string $levelName): int
{
if (!array_key_exists($levelName, $this->levelMapping)) {
throw new InvalidArgumentException('The level supplied to the Logger is not valid');
}
return $this->levelMapping[$levelName];
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/MetricsTrait.php
================================================
$metadata The metadata to update and return.
* @return array The updated metadata.
*/
protected function applyServiceApiUsageMetrics($metadata)
{
if ($credType = $this->getCredType()) {
// Add service api usage observability metrics info into metadata
// We expect upstream libries to have the metadata key populated already
$value = 'cred-type/' . $credType;
if (!isset($metadata[self::$metricMetadataKey])) {
// This case will happen only when someone invokes the updateMetadata
// method on the credentials fetcher themselves.
$metadata[self::$metricMetadataKey] = [$value];
} elseif (is_array($metadata[self::$metricMetadataKey])) {
$metadata[self::$metricMetadataKey][0] .= ' ' . $value;
} else {
$metadata[self::$metricMetadataKey] .= ' ' . $value;
}
}
return $metadata;
}
/**
* @param array $metadata The metadata to update and return.
* @param string $authRequestType The auth request type. Possible values are
* `'at'`, `'it'`, `'mds'`.
* @return array The updated metadata.
*/
protected function applyTokenEndpointMetrics($metadata, $authRequestType)
{
$metricsHeader = self::getMetricsHeader($this->getCredType(), $authRequestType);
if (!isset($metadata[self::$metricMetadataKey])) {
$metadata[self::$metricMetadataKey] = $metricsHeader;
}
return $metadata;
}
protected static function getVersion(): string
{
if (is_null(self::$version)) {
$versionFilePath = __DIR__ . '/../VERSION';
self::$version = trim((string) file_get_contents($versionFilePath));
}
return self::$version;
}
protected function getCredType(): string
{
return '';
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Middleware/AuthTokenMiddleware.php
================================================
'
*/
class AuthTokenMiddleware
{
/**
* @var callable
*/
private $httpHandler;
/**
* It must be an implementation of FetchAuthTokenInterface.
* It may also implement UpdateMetadataInterface allowing direct
* retrieval of auth related headers
* @var FetchAuthTokenInterface
*/
private $fetcher;
/**
* @var ?callable
*/
private $tokenCallback;
/**
* Creates a new AuthTokenMiddleware.
*
* @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
* @param callable|null $httpHandler (optional) callback which delivers psr7 request
* @param callable|null $tokenCallback (optional) function to be called when a new token is fetched.
*/
public function __construct(
FetchAuthTokenInterface $fetcher,
?callable $httpHandler = null,
?callable $tokenCallback = null
) {
$this->fetcher = $fetcher;
$this->httpHandler = $httpHandler;
$this->tokenCallback = $tokenCallback;
}
/**
* Updates the request with an Authorization header when auth is 'google_auth'.
*
* use Google\Auth\Middleware\AuthTokenMiddleware;
* use Google\Auth\OAuth2;
* use GuzzleHttp\Client;
* use GuzzleHttp\HandlerStack;
*
* $config = [...];
* $oauth2 = new OAuth2($config)
* $middleware = new AuthTokenMiddleware($oauth2);
* $stack = HandlerStack::create();
* $stack->push($middleware);
*
* $client = new Client([
* 'handler' => $stack,
* 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
* 'auth' => 'google_auth' // authorize all requests
* ]);
*
* $res = $client->get('myproject/taskqueues/myqueue');
*
* @param callable $handler
* @return \Closure
*/
public function __invoke(callable $handler)
{
return function (RequestInterface $request, array $options) use ($handler) {
// Requests using "auth"="google_auth" will be authorized.
if (!isset($options['auth']) || $options['auth'] !== 'google_auth') {
return $handler($request, $options);
}
$request = $this->addAuthHeaders($request);
if ($quotaProject = $this->getQuotaProject()) {
$request = $request->withHeader(
GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER,
$quotaProject
);
}
return $handler($request, $options);
};
}
/**
* Adds auth related headers to the request.
*
* @param RequestInterface $request
* @return RequestInterface
*/
private function addAuthHeaders(RequestInterface $request)
{
if (!$this->fetcher instanceof UpdateMetadataInterface ||
($this->fetcher instanceof FetchAuthTokenCache &&
!$this->fetcher->getFetcher() instanceof UpdateMetadataInterface)
) {
$token = $this->fetcher->fetchAuthToken();
$request = $request->withHeader(
'authorization',
'Bearer ' . ($token['access_token'] ?? $token['id_token'] ?? '')
);
} else {
$headers = $this->fetcher->updateMetadata($request->getHeaders(), null, $this->httpHandler);
$request = Utils::modifyRequest($request, ['set_headers' => $headers]);
}
if ($this->tokenCallback && ($token = $this->fetcher->getLastReceivedToken())) {
if (array_key_exists('access_token', $token)) {
call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $token['access_token']);
}
}
return $request;
}
/**
* @return string|null
*/
private function getQuotaProject()
{
if ($this->fetcher instanceof GetQuotaProjectInterface) {
return $this->fetcher->getQuotaProject();
}
return null;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php
================================================
'
*/
class ProxyAuthTokenMiddleware
{
/**
* @var callable
*/
private $httpHandler;
/**
* @var FetchAuthTokenInterface
*/
private $fetcher;
/**
* @var ?callable
*/
private $tokenCallback;
/**
* Creates a new ProxyAuthTokenMiddleware.
*
* @param FetchAuthTokenInterface $fetcher is used to fetch the auth token
* @param callable|null $httpHandler (optional) callback which delivers psr7 request
* @param callable|null $tokenCallback (optional) function to be called when a new token is fetched.
*/
public function __construct(
FetchAuthTokenInterface $fetcher,
?callable $httpHandler = null,
?callable $tokenCallback = null
) {
$this->fetcher = $fetcher;
$this->httpHandler = $httpHandler;
$this->tokenCallback = $tokenCallback;
}
/**
* Updates the request with an Authorization header when auth is 'google_auth'.
*
* use Google\Auth\Middleware\ProxyAuthTokenMiddleware;
* use Google\Auth\OAuth2;
* use GuzzleHttp\Client;
* use GuzzleHttp\HandlerStack;
*
* $config = [...];
* $oauth2 = new OAuth2($config)
* $middleware = new ProxyAuthTokenMiddleware($oauth2);
* $stack = HandlerStack::create();
* $stack->push($middleware);
*
* $client = new Client([
* 'handler' => $stack,
* 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
* 'proxy_auth' => 'google_auth' // authorize all requests
* ]);
*
* $res = $client->get('myproject/taskqueues/myqueue');
*
* @param callable $handler
* @return \Closure
*/
public function __invoke(callable $handler)
{
return function (RequestInterface $request, array $options) use ($handler) {
// Requests using "proxy_auth"="google_auth" will be authorized.
if (!isset($options['proxy_auth']) || $options['proxy_auth'] !== 'google_auth') {
return $handler($request, $options);
}
$request = $request->withHeader('proxy-authorization', 'Bearer ' . $this->fetchToken());
if ($quotaProject = $this->getQuotaProject()) {
$request = $request->withHeader(
GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER,
$quotaProject
);
}
return $handler($request, $options);
};
}
/**
* Call fetcher to fetch the token.
*
* @return string|null
*/
private function fetchToken()
{
$auth_tokens = $this->fetcher->fetchAuthToken($this->httpHandler);
if (array_key_exists('access_token', $auth_tokens)) {
// notify the callback if applicable
if ($this->tokenCallback) {
call_user_func(
$this->tokenCallback,
$this->fetcher->getCacheKey(),
$auth_tokens['access_token']
);
}
return $auth_tokens['access_token'];
}
if (array_key_exists('id_token', $auth_tokens)) {
return $auth_tokens['id_token'];
}
return null;
}
/**
* @return string|null;
*/
private function getQuotaProject()
{
if ($this->fetcher instanceof GetQuotaProjectInterface) {
return $this->fetcher->getQuotaProject();
}
return null;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php
================================================
'
*/
class ScopedAccessTokenMiddleware
{
use CacheTrait;
const DEFAULT_CACHE_LIFETIME = 1500;
/**
* @var callable
*/
private $tokenFunc;
/**
* @var array|string
*/
private $scopes;
/**
* Creates a new ScopedAccessTokenMiddleware.
*
* @param callable $tokenFunc a token generator function
* @param array|string $scopes the token authentication scopes
* @param array|null $cacheConfig configuration for the cache when it's present
* @param CacheItemPoolInterface|null $cache an implementation of CacheItemPoolInterface
*/
public function __construct(
callable $tokenFunc,
$scopes,
?array $cacheConfig = null,
?CacheItemPoolInterface $cache = null
) {
$this->tokenFunc = $tokenFunc;
if (!(is_string($scopes) || is_array($scopes))) {
throw new \InvalidArgumentException(
'wants scope should be string or array'
);
}
$this->scopes = $scopes;
if (!is_null($cache)) {
$this->cache = $cache;
$this->cacheConfig = array_merge([
'lifetime' => self::DEFAULT_CACHE_LIFETIME,
'prefix' => '',
], $cacheConfig);
}
}
/**
* Updates the request with an Authorization header when auth is 'scoped'.
*
* E.g this could be used to authenticate using the AppEngine
* AppIdentityService.
*
* use google\appengine\api\app_identity\AppIdentityService;
* use Google\Auth\Middleware\ScopedAccessTokenMiddleware;
* use GuzzleHttp\Client;
* use GuzzleHttp\HandlerStack;
*
* $scope = 'https://www.googleapis.com/auth/taskqueue'
* $middleware = new ScopedAccessTokenMiddleware(
* 'AppIdentityService::getAccessToken',
* $scope,
* [ 'prefix' => 'Google\Auth\ScopedAccessToken::' ],
* $cache = new Memcache()
* );
* $stack = HandlerStack::create();
* $stack->push($middleware);
*
* $client = new Client([
* 'handler' => $stack,
* 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/',
* 'auth' => 'scoped' // authorize all requests
* ]);
*
* $res = $client->get('myproject/taskqueues/myqueue');
*
* @param callable $handler
* @return \Closure
*/
public function __invoke(callable $handler)
{
return function (RequestInterface $request, array $options) use ($handler) {
// Requests using "auth"="scoped" will be authorized.
if (!isset($options['auth']) || $options['auth'] !== 'scoped') {
return $handler($request, $options);
}
$request = $request->withHeader('authorization', 'Bearer ' . $this->fetchToken());
return $handler($request, $options);
};
}
/**
* @return string
*/
private function getCacheKey()
{
$key = null;
if (is_string($this->scopes)) {
$key .= $this->scopes;
} elseif (is_array($this->scopes)) {
$key .= implode(':', $this->scopes);
}
return $key;
}
/**
* Determine if token is available in the cache, if not call tokenFunc to
* fetch it.
*
* @return string
*/
private function fetchToken()
{
$cacheKey = $this->getCacheKey();
$cached = $this->getCachedValue($cacheKey);
if (!empty($cached)) {
return $cached;
}
$token = call_user_func($this->tokenFunc, $this->scopes);
$this->setCachedValue($cacheKey, $token);
return $token;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/Middleware/SimpleMiddleware.php
================================================
*/
private $config;
/**
* Create a new Simple plugin.
*
* The configuration array expects one option
* - key: required, otherwise InvalidArgumentException is thrown
*
* @param array $config Configuration array
*/
public function __construct(array $config)
{
if (!isset($config['key'])) {
throw new \InvalidArgumentException('requires a key to have been set');
}
$this->config = array_merge(['key' => null], $config);
}
/**
* Updates the request query with the developer key if auth is set to simple.
*
* use Google\Auth\Middleware\SimpleMiddleware;
* use GuzzleHttp\Client;
* use GuzzleHttp\HandlerStack;
*
* $my_key = 'is not the same as yours';
* $middleware = new SimpleMiddleware(['key' => $my_key]);
* $stack = HandlerStack::create();
* $stack->push($middleware);
*
* $client = new Client([
* 'handler' => $stack,
* 'base_uri' => 'https://www.googleapis.com/discovery/v1/',
* 'auth' => 'simple'
* ]);
*
* $res = $client->get('drive/v2/rest');
*
* @param callable $handler
* @return \Closure
*/
public function __invoke(callable $handler)
{
return function (RequestInterface $request, array $options) use ($handler) {
// Requests using "auth"="scoped" will be authorized.
if (!isset($options['auth']) || $options['auth'] !== 'simple') {
return $handler($request, $options);
}
$query = Query::parse($request->getUri()->getQuery());
$params = array_merge($query, $this->config);
$uri = $request->getUri()->withQuery(Query::build($params));
$request = $request->withUri($uri);
return $handler($request, $options);
};
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/OAuth2.php
================================================
*/
public static $knownSigningAlgorithms = [
'HS256',
'HS512',
'HS384',
'RS256',
];
/**
* The well known grant types.
*
* @var array
*/
public static $knownGrantTypes = [
'authorization_code',
'refresh_token',
'password',
'client_credentials',
];
/**
* - authorizationUri
* The authorization server's HTTP endpoint capable of
* authenticating the end-user and obtaining authorization.
*
* @var ?UriInterface
*/
private $authorizationUri;
/**
* - tokenCredentialUri
* The authorization server's HTTP endpoint capable of issuing
* tokens and refreshing expired tokens.
*
* @var UriInterface
*/
private $tokenCredentialUri;
/**
* The redirection URI used in the initial request.
*
* @var ?string
*/
private $redirectUri;
/**
* A unique identifier issued to the client to identify itself to the
* authorization server.
*
* @var string
*/
private $clientId;
/**
* A shared symmetric secret issued by the authorization server, which is
* used to authenticate the client.
*
* @var string
*/
private $clientSecret;
/**
* The resource owner's username.
*
* @var ?string
*/
private $username;
/**
* The resource owner's password.
*
* @var ?string
*/
private $password;
/**
* The scope of the access request, expressed either as an Array or as a
* space-delimited string.
*
* @var ?array
*/
private $scope;
/**
* An arbitrary string designed to allow the client to maintain state.
*
* @var string
*/
private $state;
/**
* The authorization code issued to this client.
*
* Only used by the authorization code access grant type.
*
* @var ?string
*/
private $code;
/**
* The issuer ID when using assertion profile.
*
* @var ?string
*/
private $issuer;
/**
* The target audience for assertions.
*
* @var string
*/
private $audience;
/**
* The target sub when issuing assertions.
*
* @var string
*/
private $sub;
/**
* The number of seconds assertions are valid for.
*
* @var int
*/
private $expiry;
/**
* The signing key when using assertion profile.
*
* @var ?string
*/
private $signingKey;
/**
* The signing key id when using assertion profile. Param kid in jwt header
*
* @var string
*/
private $signingKeyId;
/**
* The signing algorithm when using an assertion profile.
*
* @var ?string
*/
private $signingAlgorithm;
/**
* The refresh token associated with the access token to be refreshed.
*
* @var ?string
*/
private $refreshToken;
/**
* The current access token.
*
* @var string
*/
private $accessToken;
/**
* The current ID token.
*
* @var string
*/
private $idToken;
/**
* The scopes granted to the current access token
*
* @var string
*/
private $grantedScope;
/**
* The lifetime in seconds of the current access token.
*
* @var ?int
*/
private $expiresIn;
/**
* The expiration time of the access token as a number of seconds since the
* unix epoch.
*
* @var ?int
*/
private $expiresAt;
/**
* The issue time of the access token as a number of seconds since the unix
* epoch.
*
* @var ?int
*/
private $issuedAt;
/**
* The current grant type.
*
* @var ?string
*/
private $grantType;
/**
* When using an extension grant type, this is the set of parameters used by
* that extension.
*
* @var array
*/
private $extensionParams;
/**
* When using the toJwt function, these claims will be added to the JWT
* payload.
*
* @var array
*/
private $additionalClaims;
/**
* The code verifier for PKCE for OAuth 2.0. When set, the authorization
* URI will contain the Code Challenge and Code Challenge Method querystring
* parameters, and the token URI will contain the Code Verifier parameter.
*
* @see https://datatracker.ietf.org/doc/html/rfc7636
* @var ?string
*/
private $codeVerifier;
/**
* For STS requests.
* A URI that indicates the target service or resource where the client
* intends to use the requested security token.
*/
private ?string $resource;
/**
* For STS requests.
* A fetcher for the "subject_token", which is a security token that
* represents the identity of the party on behalf of whom the request is
* being made.
*/
private ?ExternalAccountCredentialSourceInterface $subjectTokenFetcher;
/**
* For STS requests.
* An identifier, that indicates the type of the security token in the
* subjectToken parameter.
*/
private ?string $subjectTokenType;
/**
* For STS requests.
* A security token that represents the identity of the acting party.
*/
private ?string $actorToken;
/**
* For STS requests.
* An identifier that indicates the type of the security token in the
* actorToken parameter.
*/
private ?string $actorTokenType;
/**
* From STS response.
* An identifier for the representation of the issued security token.
*/
private ?string $issuedTokenType = null;
/**
* From STS response.
* An identifier for the representation of the issued security token.
*
* @var array
*/
private array $additionalOptions;
/**
* Create a new OAuthCredentials.
*
* The configuration array accepts various options
*
* - authorizationUri
* The authorization server's HTTP endpoint capable of
* authenticating the end-user and obtaining authorization.
*
* - tokenCredentialUri
* The authorization server's HTTP endpoint capable of issuing
* tokens and refreshing expired tokens.
*
* - clientId
* A unique identifier issued to the client to identify itself to the
* authorization server.
*
* - clientSecret
* A shared symmetric secret issued by the authorization server,
* which is used to authenticate the client.
*
* - scope
* The scope of the access request, expressed either as an Array
* or as a space-delimited String.
*
* - state
* An arbitrary string designed to allow the client to maintain state.
*
* - redirectUri
* The redirection URI used in the initial request.
*
* - username
* The resource owner's username.
*
* - password
* The resource owner's password.
*
* - issuer
* Issuer ID when using assertion profile
*
* - audience
* Target audience for assertions
*
* - expiry
* Number of seconds assertions are valid for
*
* - signingKey
* Signing key when using assertion profile
*
* - signingKeyId
* Signing key id when using assertion profile
*
* - refreshToken
* The refresh token associated with the access token
* to be refreshed.
*
* - accessToken
* The current access token for this client.
*
* - idToken
* The current ID token for this client.
*
* - extensionParams
* When using an extension grant type, this is the set of parameters used
* by that extension.
*
* - codeVerifier
* The code verifier for PKCE for OAuth 2.0.
*
* - resource
* The target service or resource where the client ntends to use the
* requested security token.
*
* - subjectTokenFetcher
* A fetcher for the "subject_token", which is a security token that
* represents the identity of the party on behalf of whom the request is
* being made.
*
* - subjectTokenType
* An identifier that indicates the type of the security token in the
* subjectToken parameter.
*
* - actorToken
* A security token that represents the identity of the acting party.
*
* - actorTokenType
* An identifier for the representation of the issued security token.
*
* @param array $config Configuration array
*/
public function __construct(array $config)
{
$opts = array_merge([
'expiry' => self::DEFAULT_EXPIRY_SECONDS,
'extensionParams' => [],
'authorizationUri' => null,
'redirectUri' => null,
'tokenCredentialUri' => null,
'state' => null,
'username' => null,
'password' => null,
'clientId' => null,
'clientSecret' => null,
'issuer' => null,
'sub' => null,
'audience' => null,
'signingKey' => null,
'signingKeyId' => null,
'signingAlgorithm' => null,
'scope' => null,
'additionalClaims' => [],
'codeVerifier' => null,
'resource' => null,
'subjectTokenFetcher' => null,
'subjectTokenType' => null,
'actorToken' => null,
'actorTokenType' => null,
'additionalOptions' => [],
], $config);
$this->setAuthorizationUri($opts['authorizationUri']);
$this->setRedirectUri($opts['redirectUri']);
$this->setTokenCredentialUri($opts['tokenCredentialUri']);
$this->setState($opts['state']);
$this->setUsername($opts['username']);
$this->setPassword($opts['password']);
$this->setClientId($opts['clientId']);
$this->setClientSecret($opts['clientSecret']);
$this->setIssuer($opts['issuer']);
$this->setSub($opts['sub']);
$this->setExpiry($opts['expiry']);
$this->setAudience($opts['audience']);
$this->setSigningKey($opts['signingKey']);
$this->setSigningKeyId($opts['signingKeyId']);
$this->setSigningAlgorithm($opts['signingAlgorithm']);
$this->setScope($opts['scope']);
$this->setExtensionParams($opts['extensionParams']);
$this->setAdditionalClaims($opts['additionalClaims']);
$this->setCodeVerifier($opts['codeVerifier']);
// for STS
$this->resource = $opts['resource'];
$this->subjectTokenFetcher = $opts['subjectTokenFetcher'];
$this->subjectTokenType = $opts['subjectTokenType'];
$this->actorToken = $opts['actorToken'];
$this->actorTokenType = $opts['actorTokenType'];
$this->additionalOptions = $opts['additionalOptions'];
$this->updateToken($opts);
}
/**
* Verifies the idToken if present.
*
* - if none is present, return null
* - if present, but invalid, raises DomainException.
* - otherwise returns the payload in the idtoken as a PHP object.
*
* The behavior of this method varies depending on the version of
* `firebase/php-jwt` you are using. In versions 6.0 and above, you cannot
* provide multiple $allowed_algs, and instead must provide an array of Key
* objects as the $publicKey.
*
* @param string|Key|Key[] $publicKey The public key to use to authenticate the token
* @param string|array $allowed_algs algorithm or array of supported verification algorithms.
* Providing more than one algorithm will throw an exception.
* @throws \DomainException if the token is missing an audience.
* @throws \DomainException if the audience does not match the one set in
* the OAuth2 class instance.
* @throws \UnexpectedValueException If the token is invalid
* @throws \InvalidArgumentException If more than one value for allowed_algs is supplied
* @throws \Firebase\JWT\SignatureInvalidException If the signature is invalid.
* @throws \Firebase\JWT\BeforeValidException If the token is not yet valid.
* @throws \Firebase\JWT\ExpiredException If the token has expired.
* @return null|object
*/
public function verifyIdToken($publicKey = null, $allowed_algs = [])
{
$idToken = $this->getIdToken();
if (is_null($idToken)) {
return null;
}
$resp = $this->jwtDecode($idToken, $publicKey, $allowed_algs);
if (!property_exists($resp, 'aud')) {
throw new \DomainException('No audience found the id token');
}
if ($resp->aud != $this->getAudience()) {
throw new \DomainException('Wrong audience present in the id token');
}
return $resp;
}
/**
* Obtains the encoded jwt from the instance data.
*
* @param array $config array optional configuration parameters
* @return string
*/
public function toJwt(array $config = [])
{
if (is_null($this->getSigningKey())) {
throw new \DomainException('No signing key available');
}
if (is_null($this->getSigningAlgorithm())) {
throw new \DomainException('No signing algorithm specified');
}
$now = time();
$opts = array_merge([
'skew' => self::DEFAULT_SKEW_SECONDS,
], $config);
$assertion = [
'iss' => $this->getIssuer(),
'exp' => ($now + $this->getExpiry()),
'iat' => ($now - $opts['skew']),
];
foreach ($assertion as $k => $v) {
if (is_null($v)) {
throw new \DomainException($k . ' should not be null');
}
}
if (!(is_null($this->getAudience()))) {
$assertion['aud'] = $this->getAudience();
}
if (!(is_null($this->getScope()))) {
$assertion['scope'] = $this->getScope();
}
if (empty($assertion['scope']) && empty($assertion['aud'])) {
throw new \DomainException('one of scope or aud should not be null');
}
if (!(is_null($this->getSub()))) {
$assertion['sub'] = $this->getSub();
}
$assertion += $this->getAdditionalClaims();
return JWT::encode(
$assertion,
$this->getSigningKey(),
$this->getSigningAlgorithm(),
$this->getSigningKeyId()
);
}
/**
* Generates a request for token credentials.
*
* @param callable|null $httpHandler callback which delivers psr7 request
* @param array $headers [optional] Additional headers to pass to
* the token endpoint request.
* @return RequestInterface the authorization Url.
*/
public function generateCredentialsRequest(?callable $httpHandler = null, array $headers = [])
{
$uri = $this->getTokenCredentialUri();
if (is_null($uri)) {
throw new \DomainException('No token credential URI was set.');
}
$grantType = $this->getGrantType();
$params = ['grant_type' => $grantType];
switch ($grantType) {
case 'authorization_code':
$params['code'] = $this->getCode();
$params['redirect_uri'] = $this->getRedirectUri();
if ($this->codeVerifier) {
$params['code_verifier'] = $this->codeVerifier;
}
$this->addClientCredentials($params);
break;
case 'password':
$params['username'] = $this->getUsername();
$params['password'] = $this->getPassword();
$this->addClientCredentials($params);
break;
case 'refresh_token':
$params['refresh_token'] = $this->getRefreshToken();
if (isset($this->getAdditionalClaims()['target_audience'])) {
$params['target_audience'] = $this->getAdditionalClaims()['target_audience'];
}
$this->addClientCredentials($params);
break;
case self::JWT_URN:
$params['assertion'] = $this->toJwt();
break;
case self::STS_URN:
$token = $this->subjectTokenFetcher->fetchSubjectToken($httpHandler);
$params['subject_token'] = $token;
$params['subject_token_type'] = $this->subjectTokenType;
$params += array_filter([
'resource' => $this->resource,
'audience' => $this->audience,
'scope' => $this->getScope(),
'requested_token_type' => self::STS_REQUESTED_TOKEN_TYPE,
'actor_token' => $this->actorToken,
'actor_token_type' => $this->actorTokenType,
]);
if ($this->additionalOptions) {
$params['options'] = json_encode($this->additionalOptions);
}
break;
default:
if (!is_null($this->getRedirectUri())) {
# Grant type was supposed to be 'authorization_code', as there
# is a redirect URI.
throw new \DomainException('Missing authorization code');
}
unset($params['grant_type']);
if (!is_null($grantType)) {
$params['grant_type'] = $grantType;
}
$params = array_merge($params, $this->getExtensionParams());
}
$headers = [
'Cache-Control' => 'no-store',
'Content-Type' => 'application/x-www-form-urlencoded',
] + $headers;
return new Request(
'POST',
$uri,
$headers,
Query::build($params)
);
}
/**
* Fetches the auth tokens based on the current state.
*
* @param callable|null $httpHandler callback which delivers psr7 request
* @param array $headers [optional] If present, add these headers to the token
* endpoint request.
* @return array the response
*/
public function fetchAuthToken(?callable $httpHandler = null, array $headers = [])
{
if (is_null($httpHandler)) {
$httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient());
}
$response = $httpHandler($this->generateCredentialsRequest($httpHandler, $headers));
$credentials = $this->parseTokenResponse($response);
$this->updateToken($credentials);
if (isset($credentials['scope'])) {
$this->setGrantedScope($credentials['scope']);
}
return $credentials;
}
/**
* @deprecated
*
* Obtains a key that can used to cache the results of #fetchAuthToken.
*
* The key is derived from the scopes.
*
* @return ?string a key that may be used to cache the auth token.
*/
public function getCacheKey()
{
if (is_array($this->scope)) {
return implode(':', $this->scope);
}
if ($this->audience) {
return $this->audience;
}
// If scope has not set, return null to indicate no caching.
return null;
}
/**
* Gets this instance's SubjectTokenFetcher
*
* @return null|ExternalAccountCredentialSourceInterface
*/
public function getSubjectTokenFetcher(): ?ExternalAccountCredentialSourceInterface
{
return $this->subjectTokenFetcher;
}
/**
* Parses the fetched tokens.
*
* @param ResponseInterface $resp the response.
* @return array the tokens parsed from the response body.
* @throws \Exception
*/
public function parseTokenResponse(ResponseInterface $resp)
{
$body = (string) $resp->getBody();
if ($resp->hasHeader('Content-Type') &&
$resp->getHeaderLine('Content-Type') == 'application/x-www-form-urlencoded'
) {
$res = [];
parse_str($body, $res);
return $res;
}
// Assume it's JSON; if it's not throw an exception
if (null === $res = json_decode($body, true)) {
throw new \Exception('Invalid JSON response');
}
return $res;
}
/**
* Updates an OAuth 2.0 client.
*
* Example:
* ```
* $oauth->updateToken([
* 'refresh_token' => 'n4E9O119d',
* 'access_token' => 'FJQbwq9',
* 'expires_in' => 3600
* ]);
* ```
*
* @param array $config
* The configuration parameters related to the token.
*
* - refresh_token
* The refresh token associated with the access token
* to be refreshed.
*
* - access_token
* The current access token for this client.
*
* - id_token
* The current ID token for this client.
*
* - expires_in
* The time in seconds until access token expiration.
*
* - expires_at
* The time as an integer number of seconds since the Epoch
*
* - issued_at
* The timestamp that the token was issued at.
* @return void
*/
public function updateToken(array $config)
{
$opts = array_merge([
'extensionParams' => [],
'access_token' => null,
'id_token' => null,
'expires_in' => null,
'expires_at' => null,
'issued_at' => null,
'scope' => null,
], $config);
$this->setExpiresAt($opts['expires_at']);
$this->setExpiresIn($opts['expires_in']);
// By default, the token is issued at `Time.now` when `expiresIn` is set,
// but this can be used to supply a more precise time.
if (!is_null($opts['issued_at'])) {
$this->setIssuedAt($opts['issued_at']);
}
$this->setAccessToken($opts['access_token']);
$this->setIdToken($opts['id_token']);
// The refresh token should only be updated if a value is explicitly
// passed in, as some access token responses do not include a refresh
// token.
if (array_key_exists('refresh_token', $opts)) {
$this->setRefreshToken($opts['refresh_token']);
}
// Required for STS response. An identifier for the representation of
// the issued security token.
if (array_key_exists('issued_token_type', $opts)) {
$this->issuedTokenType = $opts['issued_token_type'];
}
}
/**
* Builds the authorization Uri that the user should be redirected to.
*
* @param array $config configuration options that customize the return url.
* @return UriInterface the authorization Url.
* @throws InvalidArgumentException
*/
public function buildFullAuthorizationUri(array $config = [])
{
if (is_null($this->getAuthorizationUri())) {
throw new InvalidArgumentException(
'requires an authorizationUri to have been set'
);
}
$params = array_merge([
'response_type' => 'code',
'access_type' => 'offline',
'client_id' => $this->clientId,
'redirect_uri' => $this->redirectUri,
'state' => $this->state,
'scope' => $this->getScope(),
], $config);
// Validate the auth_params
if (is_null($params['client_id'])) {
throw new InvalidArgumentException(
'missing the required client identifier'
);
}
if (is_null($params['redirect_uri'])) {
throw new InvalidArgumentException('missing the required redirect URI');
}
if (!empty($params['prompt']) && !empty($params['approval_prompt'])) {
throw new InvalidArgumentException(
'prompt and approval_prompt are mutually exclusive'
);
}
if ($this->codeVerifier) {
$params['code_challenge'] = $this->getCodeChallenge($this->codeVerifier);
$params['code_challenge_method'] = $this->getCodeChallengeMethod();
}
// Construct the uri object; return it if it is valid.
$result = clone $this->authorizationUri;
$existingParams = Query::parse($result->getQuery());
$result = $result->withQuery(
Query::build(array_merge($existingParams, $params))
);
if ($result->getScheme() != 'https') {
throw new InvalidArgumentException(
'Authorization endpoint must be protected by TLS'
);
}
return $result;
}
/**
* @return string|null
*/
public function getCodeVerifier(): ?string
{
return $this->codeVerifier;
}
/**
* A cryptographically random string that is used to correlate the
* authorization request to the token request.
*
* The code verifier for PKCE for OAuth 2.0. When set, the authorization
* URI will contain the Code Challenge and Code Challenge Method querystring
* parameters, and the token URI will contain the Code Verifier parameter.
*
* @see https://datatracker.ietf.org/doc/html/rfc7636
*
* @param string|null $codeVerifier
*/
public function setCodeVerifier(?string $codeVerifier): void
{
$this->codeVerifier = $codeVerifier;
}
/**
* Generates a random 128-character string for the "code_verifier" parameter
* in PKCE for OAuth 2.0. This is a cryptographically random string that is
* determined using random_int, hashed using "hash" and sha256, and base64
* encoded.
*
* When this method is called, the code verifier is set on the object.
*
* @return string
*/
public function generateCodeVerifier(): string
{
return $this->codeVerifier = $this->generateRandomString(128);
}
private function getCodeChallenge(string $randomString): string
{
return rtrim(strtr(base64_encode(hash('sha256', $randomString, true)), '+/', '-_'), '=');
}
private function getCodeChallengeMethod(): string
{
return 'S256';
}
private function generateRandomString(int $length): string
{
$validChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~';
$validCharsLen = strlen($validChars);
$str = '';
$i = 0;
while ($i++ < $length) {
$str .= $validChars[random_int(0, $validCharsLen - 1)];
}
return $str;
}
/**
* Sets the authorization server's HTTP endpoint capable of authenticating
* the end-user and obtaining authorization.
*
* @param string $uri
* @return void
*/
public function setAuthorizationUri($uri)
{
$this->authorizationUri = $this->coerceUri($uri);
}
/**
* Gets the authorization server's HTTP endpoint capable of authenticating
* the end-user and obtaining authorization.
*
* @return ?UriInterface
*/
public function getAuthorizationUri()
{
return $this->authorizationUri;
}
/**
* Gets the authorization server's HTTP endpoint capable of issuing tokens
* and refreshing expired tokens.
*
* @return ?UriInterface
*/
public function getTokenCredentialUri()
{
return $this->tokenCredentialUri;
}
/**
* Sets the authorization server's HTTP endpoint capable of issuing tokens
* and refreshing expired tokens.
*
* @param string $uri
* @return void
*/
public function setTokenCredentialUri($uri)
{
$this->tokenCredentialUri = $this->coerceUri($uri);
}
/**
* Gets the redirection URI used in the initial request.
*
* @return ?string
*/
public function getRedirectUri()
{
return $this->redirectUri;
}
/**
* Sets the redirection URI used in the initial request.
*
* @param ?string $uri
* @return void
*/
public function setRedirectUri($uri)
{
if (is_null($uri)) {
$this->redirectUri = null;
return;
}
// redirect URI must be absolute
if (!$this->isAbsoluteUri($uri)) {
// "postmessage" is a reserved URI string in Google-land
// @see https://developers.google.com/identity/sign-in/web/server-side-flow
if ('postmessage' !== (string) $uri) {
throw new InvalidArgumentException(
'Redirect URI must be absolute'
);
}
}
$this->redirectUri = (string) $uri;
}
/**
* Gets the scope of the access requests as a space-delimited String.
*
* @return ?string
*/
public function getScope()
{
if (is_null($this->scope)) {
return $this->scope;
}
return implode(' ', $this->scope);
}
/**
* Gets the subject token type
*
* @return ?string
*/
public function getSubjectTokenType(): ?string
{
return $this->subjectTokenType;
}
/**
* Sets the scope of the access request, expressed either as an Array or as
* a space-delimited String.
*
* @param string|array|null $scope
* @return void
* @throws InvalidArgumentException
*/
public function setScope($scope)
{
if (is_null($scope)) {
$this->scope = null;
} elseif (is_string($scope)) {
$this->scope = explode(' ', $scope);
} elseif (is_array($scope)) {
foreach ($scope as $s) {
$pos = strpos($s, ' ');
if ($pos !== false) {
throw new InvalidArgumentException(
'array scope values should not contain spaces'
);
}
}
$this->scope = $scope;
} else {
throw new InvalidArgumentException(
'scopes should be a string or array of strings'
);
}
}
/**
* Gets the current grant type.
*
* @return ?string
*/
public function getGrantType()
{
if (!is_null($this->grantType)) {
return $this->grantType;
}
// Returns the inferred grant type, based on the current object instance
// state.
if (!is_null($this->code)) {
return 'authorization_code';
}
if (!is_null($this->refreshToken)) {
return 'refresh_token';
}
if (!is_null($this->username) && !is_null($this->password)) {
return 'password';
}
if (!is_null($this->issuer) && !is_null($this->signingKey)) {
return self::JWT_URN;
}
if (!is_null($this->subjectTokenFetcher) && !is_null($this->subjectTokenType)) {
return self::STS_URN;
}
return null;
}
/**
* Sets the current grant type.
*
* @param string $grantType
* @return void
* @throws InvalidArgumentException
*/
public function setGrantType($grantType)
{
if (in_array($grantType, self::$knownGrantTypes)) {
$this->grantType = $grantType;
} else {
// validate URI
if (!$this->isAbsoluteUri($grantType)) {
throw new InvalidArgumentException(
'invalid grant type'
);
}
$this->grantType = (string) $grantType;
}
}
/**
* Gets an arbitrary string designed to allow the client to maintain state.
*
* @return string
*/
public function getState()
{
return $this->state;
}
/**
* Sets an arbitrary string designed to allow the client to maintain state.
*
* @param string $state
* @return void
*/
public function setState($state)
{
$this->state = $state;
}
/**
* Gets the authorization code issued to this client.
*
* @return string
*/
public function getCode()
{
return $this->code;
}
/**
* Sets the authorization code issued to this client.
*
* @param string $code
* @return void
*/
public function setCode($code)
{
$this->code = $code;
}
/**
* Gets the resource owner's username.
*
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* Sets the resource owner's username.
*
* @param string $username
* @return void
*/
public function setUsername($username)
{
$this->username = $username;
}
/**
* Gets the resource owner's password.
*
* @return string
*/
public function getPassword()
{
return $this->password;
}
/**
* Sets the resource owner's password.
*
* @param string $password
* @return void
*/
public function setPassword($password)
{
$this->password = $password;
}
/**
* Sets a unique identifier issued to the client to identify itself to the
* authorization server.
*
* @return string
*/
public function getClientId()
{
return $this->clientId;
}
/**
* Sets a unique identifier issued to the client to identify itself to the
* authorization server.
*
* @param string $clientId
* @return void
*/
public function setClientId($clientId)
{
$this->clientId = $clientId;
}
/**
* Gets a shared symmetric secret issued by the authorization server, which
* is used to authenticate the client.
*
* @return string
*/
public function getClientSecret()
{
return $this->clientSecret;
}
/**
* Sets a shared symmetric secret issued by the authorization server, which
* is used to authenticate the client.
*
* @param string $clientSecret
* @return void
*/
public function setClientSecret($clientSecret)
{
$this->clientSecret = $clientSecret;
}
/**
* Gets the Issuer ID when using assertion profile.
*
* @return ?string
*/
public function getIssuer()
{
return $this->issuer;
}
/**
* Sets the Issuer ID when using assertion profile.
*
* @param string $issuer
* @return void
*/
public function setIssuer($issuer)
{
$this->issuer = $issuer;
}
/**
* Gets the target sub when issuing assertions.
*
* @return ?string
*/
public function getSub()
{
return $this->sub;
}
/**
* Sets the target sub when issuing assertions.
*
* @param string $sub
* @return void
*/
public function setSub($sub)
{
$this->sub = $sub;
}
/**
* Gets the target audience when issuing assertions.
*
* @return ?string
*/
public function getAudience()
{
return $this->audience;
}
/**
* Sets the target audience when issuing assertions.
*
* @param string $audience
* @return void
*/
public function setAudience($audience)
{
$this->audience = $audience;
}
/**
* Gets the signing key when using an assertion profile.
*
* @return ?string
*/
public function getSigningKey()
{
return $this->signingKey;
}
/**
* Sets the signing key when using an assertion profile.
*
* @param string $signingKey
* @return void
*/
public function setSigningKey($signingKey)
{
$this->signingKey = $signingKey;
}
/**
* Gets the signing key id when using an assertion profile.
*
* @return ?string
*/
public function getSigningKeyId()
{
return $this->signingKeyId;
}
/**
* Sets the signing key id when using an assertion profile.
*
* @param string $signingKeyId
* @return void
*/
public function setSigningKeyId($signingKeyId)
{
$this->signingKeyId = $signingKeyId;
}
/**
* Gets the signing algorithm when using an assertion profile.
*
* @return ?string
*/
public function getSigningAlgorithm()
{
return $this->signingAlgorithm;
}
/**
* Sets the signing algorithm when using an assertion profile.
*
* @param ?string $signingAlgorithm
* @return void
*/
public function setSigningAlgorithm($signingAlgorithm)
{
if (is_null($signingAlgorithm)) {
$this->signingAlgorithm = null;
} elseif (!in_array($signingAlgorithm, self::$knownSigningAlgorithms)) {
throw new InvalidArgumentException('unknown signing algorithm');
} else {
$this->signingAlgorithm = $signingAlgorithm;
}
}
/**
* Gets the set of parameters used by extension when using an extension
* grant type.
*
* @return array
*/
public function getExtensionParams()
{
return $this->extensionParams;
}
/**
* Sets the set of parameters used by extension when using an extension
* grant type.
*
* @param array $extensionParams
* @return void
*/
public function setExtensionParams($extensionParams)
{
$this->extensionParams = $extensionParams;
}
/**
* Gets the number of seconds assertions are valid for.
*
* @return int
*/
public function getExpiry()
{
return $this->expiry;
}
/**
* Sets the number of seconds assertions are valid for.
*
* @param int $expiry
* @return void
*/
public function setExpiry($expiry)
{
$this->expiry = $expiry;
}
/**
* Gets the lifetime of the access token in seconds.
*
* @return int
*/
public function getExpiresIn()
{
return $this->expiresIn;
}
/**
* Sets the lifetime of the access token in seconds.
*
* @param ?int $expiresIn
* @return void
*/
public function setExpiresIn($expiresIn)
{
if (is_null($expiresIn)) {
$this->expiresIn = null;
$this->issuedAt = null;
} else {
$this->issuedAt = time();
$this->expiresIn = (int) $expiresIn;
}
}
/**
* Gets the time the current access token expires at.
*
* @return ?int
*/
public function getExpiresAt()
{
if (!is_null($this->expiresAt)) {
return $this->expiresAt;
}
if (!is_null($this->issuedAt) && !is_null($this->expiresIn)) {
return $this->issuedAt + $this->expiresIn;
}
return null;
}
/**
* Returns true if the acccess token has expired.
*
* @return bool
*/
public function isExpired()
{
$expiration = $this->getExpiresAt();
$now = time();
return !is_null($expiration) && $now >= $expiration;
}
/**
* Sets the time the current access token expires at.
*
* @param int $expiresAt
* @return void
*/
public function setExpiresAt($expiresAt)
{
$this->expiresAt = $expiresAt;
}
/**
* Gets the time the current access token was issued at.
*
* @return ?int
*/
public function getIssuedAt()
{
return $this->issuedAt;
}
/**
* Sets the time the current access token was issued at.
*
* @param int $issuedAt
* @return void
*/
public function setIssuedAt($issuedAt)
{
$this->issuedAt = $issuedAt;
}
/**
* Gets the current access token.
*
* @return ?string
*/
public function getAccessToken()
{
return $this->accessToken;
}
/**
* Sets the current access token.
*
* @param string $accessToken
* @return void
*/
public function setAccessToken($accessToken)
{
$this->accessToken = $accessToken;
}
/**
* Gets the current ID token.
*
* @return ?string
*/
public function getIdToken()
{
return $this->idToken;
}
/**
* Sets the current ID token.
*
* @param string $idToken
* @return void
*/
public function setIdToken($idToken)
{
$this->idToken = $idToken;
}
/**
* Get the granted space-separated scopes (if they exist) for the last
* fetched token.
*
* @return string|null
*/
public function getGrantedScope()
{
return $this->grantedScope;
}
/**
* Sets the current ID token.
*
* @param string $grantedScope
* @return void
*/
public function setGrantedScope($grantedScope)
{
$this->grantedScope = $grantedScope;
}
/**
* Gets the refresh token associated with the current access token.
*
* @return ?string
*/
public function getRefreshToken()
{
return $this->refreshToken;
}
/**
* Sets the refresh token associated with the current access token.
*
* @param string $refreshToken
* @return void
*/
public function setRefreshToken($refreshToken)
{
$this->refreshToken = $refreshToken;
}
/**
* Sets additional claims to be included in the JWT token
*
* @param array $additionalClaims
* @return void
*/
public function setAdditionalClaims(array $additionalClaims)
{
$this->additionalClaims = $additionalClaims;
}
/**
* Gets the additional claims to be included in the JWT token.
*
* @return array
*/
public function getAdditionalClaims()
{
return $this->additionalClaims;
}
/**
* Gets the additional claims to be included in the JWT token.
*
* @return ?string
*/
public function getIssuedTokenType()
{
return $this->issuedTokenType;
}
/**
* The expiration of the last received token.
*
* @return array|null
*/
public function getLastReceivedToken()
{
if ($token = $this->getAccessToken()) {
// the bare necessity of an auth token
$authToken = [
'access_token' => $token,
'expires_at' => $this->getExpiresAt(),
];
} elseif ($idToken = $this->getIdToken()) {
$authToken = [
'id_token' => $idToken,
'expires_at' => $this->getExpiresAt(),
];
} else {
return null;
}
if ($expiresIn = $this->getExpiresIn()) {
$authToken['expires_in'] = $expiresIn;
}
if ($issuedAt = $this->getIssuedAt()) {
$authToken['issued_at'] = $issuedAt;
}
if ($refreshToken = $this->getRefreshToken()) {
$authToken['refresh_token'] = $refreshToken;
}
return $authToken;
}
/**
* Get the client ID.
*
* Alias of {@see OAuth2::getClientId()}.
*
* @param callable|null $httpHandler
* @return string
* @access private
*/
public function getClientName(?callable $httpHandler = null)
{
return $this->getClientId();
}
/**
* @todo handle uri as array
*
* @param ?string $uri
* @return null|UriInterface
*/
private function coerceUri($uri)
{
if (is_null($uri)) {
return null;
}
return Utils::uriFor($uri);
}
/**
* @param string $idToken
* @param Key|Key[]|string|string[] $publicKey
* @param string|string[] $allowedAlgs
* @return object
*/
private function jwtDecode($idToken, $publicKey, $allowedAlgs)
{
$keys = $this->getFirebaseJwtKeys($publicKey, $allowedAlgs);
// Default exception if none are caught. We are using the same exception
// class and message from firebase/php-jwt to preserve backwards
// compatibility.
$e = new \InvalidArgumentException('Key may not be empty');
foreach ($keys as $key) {
try {
return JWT::decode($idToken, $key);
} catch (\Exception $e) {
// try next alg
}
}
throw $e;
}
/**
* @param Key|Key[]|string|string[] $publicKey
* @param string|string[] $allowedAlgs
* @return Key[]
*/
private function getFirebaseJwtKeys($publicKey, $allowedAlgs)
{
// If $publicKey is instance of Key, return it
if ($publicKey instanceof Key) {
return [$publicKey];
}
// If $allowedAlgs is empty, $publicKey must be Key or Key[].
if (empty($allowedAlgs)) {
$keys = [];
foreach ((array) $publicKey as $kid => $pubKey) {
if (!$pubKey instanceof Key) {
throw new \InvalidArgumentException(sprintf(
'When allowed algorithms is empty, the public key must'
. 'be an instance of %s or an array of %s objects',
Key::class,
Key::class
));
}
$keys[$kid] = $pubKey;
}
return $keys;
}
$allowedAlg = null;
if (is_string($allowedAlgs)) {
$allowedAlg = $allowedAlgs;
} elseif (is_array($allowedAlgs)) {
if (count($allowedAlgs) > 1) {
throw new \InvalidArgumentException(
'To have multiple allowed algorithms, You must provide an'
. ' array of Firebase\JWT\Key objects.'
. ' See https://github.com/firebase/php-jwt for more information.'
);
}
$allowedAlg = array_pop($allowedAlgs);
} else {
throw new \InvalidArgumentException('allowed algorithms must be a string or array.');
}
if (is_array($publicKey)) {
// When publicKey is greater than 1, create keys with the single alg.
$keys = [];
foreach ($publicKey as $kid => $pubKey) {
if ($pubKey instanceof Key) {
$keys[$kid] = $pubKey;
} else {
$keys[$kid] = new Key($pubKey, $allowedAlg);
}
}
return $keys;
}
return [new Key($publicKey, $allowedAlg)];
}
/**
* Determines if the URI is absolute based on its scheme and host or path
* (RFC 3986).
*
* @param string $uri
* @return bool
*/
private function isAbsoluteUri($uri)
{
$uri = $this->coerceUri($uri);
return $uri->getScheme() && ($uri->getHost() || $uri->getPath());
}
/**
* @param array $params
* @return array
*/
private function addClientCredentials(&$params)
{
$clientId = $this->getClientId();
$clientSecret = $this->getClientSecret();
if ($clientId && $clientSecret) {
$params['client_id'] = $clientId;
$params['client_secret'] = $clientSecret;
}
return $params;
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/ProjectIdProviderInterface.php
================================================
auth->getSigningKey();
$signedString = '';
if (class_exists(phpseclib3\Crypt\RSA::class) && !$forceOpenssl) {
$key = PublicKeyLoader::load($privateKey);
$rsa = $key->withHash('sha256')->withPadding(RSA::SIGNATURE_PKCS1);
$signedString = $rsa->sign($stringToSign);
} elseif (extension_loaded('openssl')) {
openssl_sign($stringToSign, $signedString, $privateKey, 'sha256WithRSAEncryption');
} else {
// @codeCoverageIgnoreStart
throw new \RuntimeException('OpenSSL is not installed.');
}
// @codeCoverageIgnoreEnd
return base64_encode($signedString);
}
}
================================================
FILE: lib/Google/vendor/google/auth/src/SignBlobInterface.php
================================================
$metadata metadata hashmap
* @param string $authUri optional auth uri
* @param callable|null $httpHandler callback which delivers psr7 request
* @return array updated metadata hashmap
*/
public function updateMetadata(
$metadata,
$authUri = null,
?callable $httpHandler = null
);
}
================================================
FILE: lib/Google/vendor/google/auth/src/UpdateMetadataTrait.php
================================================
$metadata metadata hashmap
* @param string $authUri optional auth uri
* @param callable|null $httpHandler callback which delivers psr7 request
* @return array updated metadata hashmap
*/
public function updateMetadata(
$metadata,
$authUri = null,
?callable $httpHandler = null
) {
$metadata_copy = $metadata;
// We do need to set the service api usage metrics irrespective even if
// the auth token is set because invoking this method with auth tokens
// would mean the intention is to just explicitly set the metrics metadata.
$metadata_copy = $this->applyServiceApiUsageMetrics($metadata_copy);
if (isset($metadata_copy[self::AUTH_METADATA_KEY])) {
// Auth metadata has already been set
return $metadata_copy;
}
$result = $this->fetchAuthToken($httpHandler);
if (isset($result['access_token'])) {
$metadata_copy[self::AUTH_METADATA_KEY] = ['Bearer ' . $result['access_token']];
} elseif (isset($result['id_token'])) {
$metadata_copy[self::AUTH_METADATA_KEY] = ['Bearer ' . $result['id_token']];
}
return $metadata_copy;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/.gitattributes
================================================
/*.xml.dist export-ignore
/tests export-ignore
/.github export-ignore
================================================
FILE: lib/Google/vendor/google/cloud-core/CODE_OF_CONDUCT.md
================================================
# Contributor Code of Conduct
As contributors and maintainers of this project,
and in the interest of fostering an open and welcoming community,
we pledge to respect all people who contribute through reporting issues,
posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.
We are committed to making participation in this project
a harassment-free experience for everyone,
regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information,
such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct.
By adopting this Code of Conduct,
project maintainers commit themselves to fairly and consistently
applying these principles to every aspect of managing this project.
Project maintainers who do not follow or enforce the Code of Conduct
may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior
may be reported by opening an issue
or contacting one or more of the project maintainers.
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
================================================
FILE: lib/Google/vendor/google/cloud-core/CONTRIBUTING.md
================================================
# How to Contribute
We'd love to accept your patches and contributions to this project. We accept
and review pull requests against the main
[Google Cloud PHP](https://github.com/googleapis/google-cloud-php)
repository, which contains all of our client libraries. You will also need to
sign a Contributor License Agreement. For more details about how to contribute,
see the
[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md)
file in the main Google Cloud PHP repository.
================================================
FILE: lib/Google/vendor/google/cloud-core/LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: lib/Google/vendor/google/cloud-core/README.md
================================================
# Google Cloud Core Libraries for PHP
[](https://packagist.org/packages/google/cloud-core) [](https://packagist.org/packages/google/cloud-core)
* [API documentation](https://cloud.google.com/php/docs/reference/cloud-core/latest)
**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any
support requests, bug reports, or development contributions should be directed to
that project.
### Installation
**NOTE** This package is not intended for direct use. It provides common infrastructure
to the rest of the Google Cloud PHP components.
```sh
$ composer require google/cloud-core
```
### Debugging
Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)
for more information about the debugging tools.
### Version
This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in
any minor or patch releases. We will address issues and requests with the highest priority.
================================================
FILE: lib/Google/vendor/google/cloud-core/SECURITY.md
================================================
# Security Policy
To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
================================================
FILE: lib/Google/vendor/google/cloud-core/VERSION
================================================
1.69.0
================================================
FILE: lib/Google/vendor/google/cloud-core/bin/google-cloud-batch
================================================
#!/usr/bin/env php
run();
} else {
$idNum = (int) $argv[2];
$job = $daemon->job($idNum);
$job->run();
}
} elseif ($argv[1] === 'retry') {
$retry = new Retry();
$retry->retryAll();
} else {
showUsageAndDie();
}
================================================
FILE: lib/Google/vendor/google/cloud-core/composer.json
================================================
{
"name": "google/cloud-core",
"description": "Google Cloud PHP shared dependency, providing functionality useful to all components.",
"license": "Apache-2.0",
"minimum-stability": "stable",
"require": {
"php": "^8.1",
"rize/uri-template": "~0.3||~0.4",
"google/auth": "^1.34",
"guzzlehttp/guzzle": "^6.5.8||^7.4.4",
"guzzlehttp/promises": "^1.4||^2.0",
"guzzlehttp/psr7": "^2.6",
"monolog/monolog": "^2.9||^3.0",
"psr/http-message": "^1.0||^2.0",
"google/gax": "^1.38.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
"phpspec/prophecy-phpunit": "^2.0",
"squizlabs/php_codesniffer": "2.*",
"phpdocumentor/reflection": "^6.0",
"phpdocumentor/reflection-docblock": "^5.3",
"erusev/parsedown": "^1.6",
"opis/closure": "^3.7|^4.0",
"google/cloud-common-protos": "~0.5",
"nikic/php-parser": "^5.6"
},
"suggest": {
"opis/closure": "May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.",
"symfony/lock": "Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9"
},
"extra": {
"component": {
"id": "cloud-core",
"target": "googleapis/google-cloud-php-core.git",
"path": "Core",
"entry": "src/ServiceBuilder.php"
}
},
"bin": [
"bin/google-cloud-batch"
],
"autoload": {
"psr-4": {
"Google\\Cloud\\Core\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Google\\Cloud\\Core\\Tests\\": "tests"
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/perf-bootstrap.php
================================================
null
];
/**
* Fetches the auth token. In this case it returns a null value.
*
* @param callable $httpHandler
* @return array
*/
public function fetchAuthToken(?callable $httpHandler = null)
{
return $this->token;
}
/**
* Returns the cache key. In this case it returns a null value, disabling
* caching.
*
* @return string|null
*/
public function getCacheKey()
{
return null;
}
/**
* Fetches the last received token. In this case, it returns the same null
* auth token.
*
* @return array
*/
public function getLastReceivedToken()
{
return $this->token;
}
/**
* This method has no effect for AnonymousCredentials.
*
* @param array $metadata metadata hashmap
* @param string $authUri optional auth uri
* @param callable $httpHandler callback which delivers psr7 request
* @return array updated metadata hashmap
*/
public function updateMetadata(
$metadata,
$authUri = null,
?callable $httpHandler = null
) {
return $metadata;
}
/**
* This method always returns null for AnonymousCredentials.
*
* @return string|null
*/
public function getQuotaProject()
{
return null;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/ApiHelperTrait.php
================================================
$value) {
$fFields[$key] = $this->formatValueForApi($value);
}
return ['fields' => $fFields];
}
private function unpackStructFromApi(array $struct)
{
$vals = [];
foreach ($struct['fields'] as $key => $val) {
$vals[$key] = $this->unpackValue($val);
}
return $vals;
}
private function unpackValue($value)
{
if (count($value) > 1) {
throw new \RuntimeException("Unexpected fields in struct: $value");
}
foreach ($value as $setField => $setValue) {
switch ($setField) {
case 'listValue':
$valueList = [];
foreach ($setValue['values'] as $innerValue) {
$valueList[] = $this->unpackValue($innerValue);
}
return $valueList;
case 'structValue':
return $this->unpackStructFromApi($value['structValue']);
default:
return $setValue;
}
}
}
private function flattenStruct(array $struct)
{
return $struct['fields'];
}
private function flattenValue(array $value)
{
if (count($value) > 1) {
throw new \RuntimeException("Unexpected fields in struct: $value");
}
if (isset($value['nullValue'])) {
return null;
}
return array_pop($value);
}
private function flattenListValue(array $value)
{
return $value['values'];
}
/**
* Format a list for the API.
*
* @param array $list
* @return array
*/
private function formatListForApi(array $list)
{
$values = [];
foreach ($list as $value) {
$values[] = $this->formatValueForApi($value);
}
return ['values' => $values];
}
/**
* Format a value for the API.
*
* @param mixed $value
* @return array
*/
private function formatValueForApi($value)
{
$type = gettype($value);
switch ($type) {
case 'string':
return ['string_value' => $value];
case 'double':
case 'integer':
return ['number_value' => $value];
case 'boolean':
return ['bool_value' => $value];
case 'NULL':
return ['null_value' => NullValue::NULL_VALUE];
case 'array':
if (!empty($value) && $this->isAssoc($value)) {
return ['struct_value' => $this->formatStructForApi($value)];
}
return ['list_value' => $this->formatListForApi($value)];
}
return [];
}
/**
* Format a gRPC timestamp to match the format returned by the REST API.
*
* @param array $timestamp
* @return string
*/
private function formatTimestampFromApi(array $timestamp)
{
$timestamp += [
'seconds' => 0,
'nanos' => 0
];
$dt = $this->createDateTimeFromSeconds($timestamp['seconds']);
return $this->formatTimeAsString($dt, $timestamp['nanos']);
}
/**
* Format a timestamp for the API with nanosecond precision.
*
* @param string $value
* @return array
*/
private function formatTimestampForApi($value)
{
list($dt, $nanos) = $this->parseTimeString($value);
return [
'seconds' => (int) $dt->format('U'),
'nanos' => (int) $nanos
];
}
/**
* Format a duration for the API.
*
* @param string|mixed $value
* @return array
*/
private function formatDurationForApi($value)
{
if (is_string($value)) {
$d = explode('.', trim($value, 's'));
if (count($d) < 2) {
$seconds = $d[0];
$nanos = 0;
} else {
$seconds = (int) $d[0];
$nanos = $this->convertFractionToNanoSeconds($d[1]);
}
} elseif ($value instanceof Duration) {
$d = $value->get();
$seconds = $d['seconds'];
$nanos = $d['nanos'];
}
return [
'seconds' => $seconds,
'nanos' => $nanos
];
}
/**
* Construct a gapic client. Allows for tests to intercept.
*
* @param string $gapicName
* @param array $config
* @return mixed
*/
protected function constructGapic($gapicName, array $config)
{
return new $gapicName($config);
}
/**
* Helper function to convert selective elements into protos out of a given input array.
*
* Example:
* ```
* $output = $topic->convertDataToProtos(['schema' =>[], 'other vals'], ['schema' => Schema::class]);
* $output['schema']; // This will be of the Schema type.
* ```
*
* @param array $input The input array.
* @param array $map The key,value pairs specifying the elements and the proto classes.
*
* @return array The modified array
*/
private function convertDataToProtos(array $input, array $map): array
{
if (!isset($this->serializer)) {
throw new \LogicException('Serializer must be set to use this function');
}
foreach ($map as $key => $className) {
if (isset($input[$key])) {
$input[$key] = $this->serializer->decodeMessage(new $className(), $input[$key]);
}
}
return $input;
}
/**
* Helper method used to split a supplied set of options into parameters that are passed into
* a proto message and optional args.
* We strictly treat the parameters allowed by `CallOptions` in GAX as the optional params
* and everything else that is passed is passed to the Proto message constructor.
*/
private function splitOptionalArgs(array $input, array $extraAllowedKeys = []): array
{
$callOptionFields = array_keys((new CallOptions([]))->toArray());
$keys = array_merge($callOptionFields, $extraAllowedKeys);
$callOptions = $this->pluckArray($keys, $input);
return [$input, $callOptions];
}
/**
* Helper method used to validate optons based on the supplied $optionTypes
* $optionTypes can be an array of string keys, a protobuf Message classname, or a
* the CallOptions classname. Parameters are split and returned in the order
* that the options types are provided.
*
* @throws LogicException
*/
private function validateOptions(array $options, array|Message|string ...$optionTypes): array
{
if (!isset($this->optionsValidator)) {
$this->optionsValidator = new OptionsValidator();
}
return $this->optionsValidator->validateOptions($options, ...$optionTypes);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/ArrayTrait.php
================================================
pluck($key, $arr, false);
}
}
return $values;
}
/**
* Determine whether given array is associative.
* If $arr is empty, then $onEmpty will be returned
* $onEmpty defaults to true to maintain compatibility
* with the current usage.
*
* @param array $arr
* @param bool $onEmpty
* @return bool
*/
private function isAssoc(array $arr, $onEmpty = true)
{
if (empty($arr)) {
return $onEmpty;
}
return array_keys($arr) !== range(0, count($arr) - 1);
}
/**
* Just like array_filter(), but preserves falsey values except null.
*
* @param array $arr
* @return array
*/
private function arrayFilterRemoveNull(array $arr)
{
return array_filter($arr, function ($element) {
return !is_null($element);
});
}
/**
* A method, similar to PHP's `array_merge_recursive`, with two differences.
*
* 1. Keys in $array2 take precedence over keys in $array1.
* 2. Non-array keys found in both inputs are not transformed into an array
* and appended. Rather, the value in $array2 is used.
*
* @param array $array1
* @param array $array2
* @return array
*/
private function arrayMergeRecursive(array $array1, array $array2)
{
foreach ($array2 as $key => $value) {
if (array_key_exists($key, $array1) && is_array($array1[$key]) && is_array($value)) {
$array1[$key] = ($this->isAssoc($array1[$key]) && $this->isAssoc($value))
? $this->arrayMergeRecursive($array1[$key], $value)
: array_merge($array1[$key], $value);
} else {
$array1[$key] = $value;
}
}
return $array1;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/BatchDaemon.php
================================================
isSysvIPCLoaded()) {
throw new \RuntimeException('SystemV IPC extensions are missing.');
}
$this->runner = new BatchRunner(
new SysvConfigStorage(),
new SysvProcessor()
);
$this->shutdown = false;
// Just share the usual descriptors.
$this->descriptorSpec = [
0 => ['file', 'php://stdin', 'r'],
1 => ['file', 'php://stdout', 'w'],
2 => ['file', 'php://stderr', 'w']
];
$this->command = sprintf('exec php -d auto_prepend_file="" %s daemon', $entrypoint);
$this->initFailureFile();
}
/**
* A loop for the parent.
*
* @return void
*/
public function run()
{
$this->setupSignalHandlers();
$procs = [];
while (true) {
$jobs = $this->runner->getJobs();
foreach ($jobs as $job) {
if (! array_key_exists($job->identifier(), $procs)) {
$procs[$job->identifier()] = [];
}
while (count($procs[$job->identifier()]) > $job->numWorkers()) {
// Stopping an excessive child.
echo 'Stopping an excessive child.' . PHP_EOL;
$proc = array_pop($procs[$job->identifier()]);
$status = proc_get_status($proc);
// Keep sending SIGTERM until the child exits.
while ($status['running'] === true) {
@proc_terminate($proc);
usleep(50000);
$status = proc_get_status($proc);
}
@proc_close($proc);
}
for ($i = 0; $i < $job->numWorkers(); $i++) {
$needStart = false;
if (array_key_exists($i, $procs[$job->identifier()])) {
$status = proc_get_status($procs[$job->identifier()][$i]);
if ($status['running'] !== true) {
$needStart = true;
}
} else {
$needStart = true;
}
if ($needStart) {
echo 'Starting a child.' . PHP_EOL;
$procs[$job->identifier()][$i] = proc_open(
sprintf('%s %d', $this->command, $job->id()),
$this->descriptorSpec,
$pipes
);
}
}
}
usleep(1000000); // Reload the config after 1 second
pcntl_signal_dispatch();
if ($this->shutdown) {
echo 'Shutting down, waiting for the children' . PHP_EOL;
foreach ($procs as $k => $v) {
foreach ($v as $proc) {
$status = proc_get_status($proc);
// Keep sending SIGTERM until the child exits.
while ($status['running'] === true) {
@proc_terminate($proc);
usleep(50000);
$status = proc_get_status($proc);
}
@proc_close($proc);
}
}
echo 'BatchDaemon exiting' . PHP_EOL;
exit;
}
// Reload the config
$this->runner->loadConfig();
gc_collect_cycles();
}
}
/**
* Fetch the child job by id.
*
* @param int $idNum The id of the job to find
* @return JobInterface
*/
public function job($idNum)
{
return $this->runner->getJobFromIdNum($idNum);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/BatchDaemonTrait.php
================================================
self::DEFAULT_BATCH_SIZE,
'callPeriod' => self::DEFAULT_CALL_PERIOD,
'bootstrapFile' => null,
'numWorkers' => self::DEFAULT_WORKERS
];
$this->identifier = $identifier;
$this->func = $func;
$this->id = $idNum;
$this->batchSize = $options['batchSize'];
$this->callPeriod = $options['callPeriod'];
$this->bootstrapFile = $options['bootstrapFile'];
$this->numWorkers = $options['numWorkers'];
$this->initFailureFile();
}
/**
* Run the job.
*/
public function run()
{
$this->setupSignalHandlers();
$sysvKey = $this->getSysvKey($this->id);
$q = msg_get_queue($sysvKey);
$items = [];
$lastInvoked = microtime(true);
if (!is_null($this->bootstrapFile)) {
require_once($this->bootstrapFile);
}
while (true) {
// Fire SIGALRM after 1 second to unblock the blocking call.
pcntl_alarm(1);
if (msg_receive(
$q,
0,
$type,
8192,
$message,
true,
0, // blocking mode
$errorcode
)) {
if ($type === self::$typeDirect) {
$items[] = $message;
} elseif ($type === self::$typeFile) {
$items[] = unserialize(file_get_contents($message));
@unlink($message);
}
}
pcntl_signal_dispatch();
// It runs the job when
// 1. Number of items reaches the batchSize.
// 2-a. Count is >0 and the current time is larger than lastInvoked + period.
// 2-b. Count is >0 and the shutdown flag is true.
if ((count($items) >= $this->batchSize)
|| (count($items) > 0
&& (microtime(true) > $lastInvoked + $this->callPeriod
|| $this->shutdown))) {
printf(
'Running the job with %d items' . PHP_EOL,
count($items)
);
$this->flush($items);
$items = [];
$lastInvoked = microtime(true);
}
gc_collect_cycles();
if ($this->shutdown) {
return;
}
}
}
/**
* Finish any pending activity for this job.
*
* @param array $items
* @return bool
*/
public function flush(array $items = [])
{
if (! $this->callFunc($items)) {
$this->handleFailure($this->id, $items);
return false;
}
return true;
}
/**
* Finish any pending activity for this job.
*
* @access private
* @internal
*
* @param array $items
* @return bool
*/
public function callFunc(array $items = [])
{
return call_user_func_array($this->func, [$items]);
}
/**
* Returns the period in seconds from the last execution to force
* executing the job.
*
* @return float
*/
public function getCallPeriod()
{
return $this->callPeriod;
}
/**
* Returns the batch size.
*
* @return int
*/
public function getBatchSize()
{
return $this->batchSize;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/BatchRunner.php
================================================
isSysvIPCLoaded() && $this->isDaemonRunning()) {
$configStorage = new SysvConfigStorage();
$processor = new SysvProcessor();
} else {
$configStorage = InMemoryConfigStorage::getInstance();
$processor = $configStorage;
}
}
$this->configStorage = $configStorage;
$this->processor = $processor;
$this->loadConfig();
}
/**
* Register a job for batch execution.
*
* @param string $identifier Unique identifier of the job.
* @param callable $func Any Callable except for Closure. The callable
* should accept an array of items as the first argument.
* @param array $options [optional] {
* Configuration options.
*
* @type int $batchSize The size of the batch.
* @type float $callPeriod The period in seconds from the last execution
* to force executing the job.
* @type int $numWorkers The number of child processes. It only takes
* effect with the {@see \Google\Cloud\Core\Batch\BatchDaemon}.
* @type string $bootstrapFile A file to load before executing the
* job. It's needed for registering global functions.
* }
* @return bool true on success, false on failure
* @throws \InvalidArgumentException When receiving a Closure.
*/
public function registerJob($identifier, $func, array $options = [])
{
if ($func instanceof \Closure) {
throw new \InvalidArgumentException('Closure is not allowed');
}
// Always work on the latest data
$result = $this->configStorage->lock();
if ($result === false) {
return false;
}
$this->config = $this->configStorage->load();
$this->config->registerJob(
$identifier,
function ($id) use ($identifier, $func, $options) {
return new BatchJob($identifier, $func, $id, $options);
}
);
try {
$result = $this->configStorage->save($this->config);
} finally {
$this->configStorage->unlock();
}
return $result;
}
/**
* Submit an item.
*
* @param string $identifier Unique identifier of the job.
* @param mixed $item It needs to be serializable.
*
* @return void
* @throws \RuntimeException
*/
public function submitItem($identifier, $item)
{
$job = $this->getJobFromId($identifier);
if ($job === null) {
throw new \RuntimeException(
"The identifier does not exist: $identifier"
);
}
$idNum = $job->id();
$this->processor->submit($item, $idNum);
}
/**
* Get the job with the given identifier.
*
* @param string $identifier Unique identifier of the job.
*
* @return BatchJob|null
*/
public function getJobFromId($identifier)
{
return $this->config->getJobFromId($identifier);
}
/**
* Get the job with the given numeric id.
*
* @param int $idNum A numeric id of the job.
*
* @return BatchJob|null
*/
public function getJobFromIdNum($idNum)
{
return $this->config->getJobFromIdNum($idNum);
}
/**
* Get all the jobs.
*
* @return BatchJob[]
*/
public function getJobs()
{
return $this->config->getJobs();
}
/**
* Load the config from the storage.
*
* @return bool true on success
* @throws \RuntimeException when it fails to load the config.
*/
public function loadConfig()
{
$result = $this->configStorage->lock();
if ($result === false) {
throw new \RuntimeException('Failed to lock the configStorage');
}
try {
$result = $this->configStorage->load();
} catch (\RuntimeException $e) {
$this->configStorage->clear();
throw $e;
} finally {
$this->configStorage->unlock();
}
$this->config = $result;
return true;
}
/**
* Gets the item processor.
*
* @return ProcessItemInterface
*/
public function getProcessor()
{
return $this->processor;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/BatchTrait.php
================================================
batchRunner
->getJobFromId($this->identifier)
->id();
return $this->batchRunner
->getProcessor()
->flush($id);
}
/**
* Deliver a list of items in a batch call.
*
* @param array $items
* @return bool
* @access private
*/
public function send(array $items)
{
$start = microtime(true);
try {
call_user_func_array($this->getCallback(), [$items]);
} catch (\Exception $e) {
if ($this->debugOutput) {
fwrite(
$this->debugOutputResource,
$e->getMessage() . PHP_EOL . PHP_EOL
. $e->getTraceAsString() . PHP_EOL
);
}
return false;
}
$end = microtime(true);
if ($this->debugOutput) {
fwrite(
$this->debugOutputResource,
sprintf(
'%f seconds for %s: %d items' . PHP_EOL,
$end - $start,
$this->batchMethod,
count($items)
)
);
fwrite(
$this->debugOutputResource,
sprintf(
'memory used: %d' . PHP_EOL,
memory_get_usage()
)
);
}
return true;
}
/**
* Returns an array representation of a callback which will be used to write
* batch items.
*
* @return array
*/
abstract protected function getCallback();
/**
* @param array $options [optional] {
* Configuration options.
*
* @type resource $debugOutputResource A resource to output debug output
* to. **Defaults to** `php://stderr`.
* @type bool $debugOutput Whether or not to output debug information.
* Please note that unless a debug output resource is configured
* this setting will only apply to CLI based applications.
* **Defaults to** `false`.
* @type array $batchOptions A set of options for a BatchJob.
* {@see \Google\Cloud\Core\Batch\BatchJob::__construct()} for
* more details.
* **Defaults to** ['batchSize' => 1000,
* 'callPeriod' => 2.0,
* 'numWorkers' => 2].
* @type array $clientConfig A config used to construct the client upon
* which requests will be made.
* @type BatchRunner $batchRunner A BatchRunner object. Mainly used for
* the tests to inject a mock. **Defaults to** a newly created
* BatchRunner.
* @type string $identifier An identifier for the batch job. This
* value must be unique across all job configs.
* @type string $batchMethod The name of the batch method used to
* deliver items.
* @type ClosureSerializerInterface $closureSerializer An implementation
* responsible for serializing closures used in the
* `$clientConfig`. This is especially important when using the
* batch daemon. **Defaults to**
* {@see \Google\Cloud\Core\Batch\OpisClosureSerializer} if the
* `opis/closure` library is installed.
* }
* @throws \InvalidArgumentException
*/
private function setCommonBatchProperties(array $options = [])
{
if (!isset($options['identifier'])) {
throw new \InvalidArgumentException(
'A valid identifier is required in order to register a job.'
);
}
if (!isset($options['batchMethod'])) {
throw new \InvalidArgumentException(
'A batchMethod is required.'
);
}
$this->setSerializableClientOptions($options);
$this->batchMethod = $options['batchMethod'];
$this->identifier = $options['identifier'];
$this->debugOutputResource = $options['debugOutputResource'] ?? fopen('php://stderr', 'w');
$this->debugOutput = $options['debugOutput'] ?? false;
$batchOptions = $options['batchOptions'] ?? [];
$this->batchOptions = $batchOptions + [
'batchSize' => 1000,
'callPeriod' => 2.0,
'numWorkers' => 2
];
$this->batchRunner = $options['batchRunner'] ?? new BatchRunner();
$this->batchRunner->registerJob(
$this->identifier,
[$this, 'send'],
$this->batchOptions
);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/ClosureSerializerInterface.php
================================================
baseDir = getenv('GOOGLE_CLOUD_BATCH_DAEMON_FAILURE_DIR');
if ('false' === $this->baseDir) {
// setting the file to the string "false" will prevent logging of failed items
return;
}
if ($this->baseDir === false) {
$this->baseDir = sprintf(
'%s/batch-daemon-failure',
sys_get_temp_dir()
);
}
if (!is_dir($this->baseDir) && !@mkdir($this->baseDir, 0700, true) && !is_dir($this->baseDir)) {
throw new \RuntimeException(
sprintf(
'Could not create a directory: %s',
$this->baseDir
)
);
}
// Use getmypid for simplicity.
$this->failureFile = sprintf(
'%s/failed-items-%d',
$this->baseDir,
getmypid()
);
}
/**
* Save the items to the failureFile. We silently abandon the items upon
* failures in this method because there's nothing we can do.
*
* @param int $idNum A numeric id for the job.
* @param array $items Items to save.
*/
public function handleFailure($idNum, array $items)
{
if (!$this->failureFile) {
$this->initFailureFile();
}
if ($this->failureFile) {
$fp = @fopen($this->failureFile, 'a');
@fwrite($fp, json_encode(serialize([$idNum => $items])) . PHP_EOL);
@fclose($fp);
}
}
/**
* Get all the filenames for the failure files.
*
* @return array Filenames for all the failure files.
*/
private function getFailedFiles()
{
$pattern = sprintf('%s/failed-items-*', $this->baseDir);
return glob($pattern) ?: [];
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/InMemoryConfigStorage.php
================================================
config = new JobConfig();
$this->created = microtime(true);
$this->initFailureFile();
$this->hasShutdownHookRegistered = false;
}
/**
* Just return true
*
* @return bool
*/
public function lock()
{
return true;
}
/**
* Just return true
*
* @return bool
*/
public function unlock()
{
return true;
}
/**
* Save the given JobConfig.
*
* @param JobConfig $config A JobConfig to save.
* @return bool
*/
public function save(JobConfig $config)
{
$this->config = $config;
return true;
}
/**
* Load a JobConfig from the storage.
*
* @return JobConfig
* @throws \RuntimeException when failed to load the JobConfig.
*/
public function load()
{
return $this->config;
}
/**
* Clear the JobConfig from storage.
*/
public function clear()
{
$this->config = new JobConfig();
}
/**
* Hold the items in memory and run the job in the same process when it
* meets the condition.
*
* We want to delay registering the shutdown function. The error
* reporter also registers a shutdown function and the order matters.
*
* @see \Google\Cloud\ErrorReporting\Bootstrap::init()
* @see http://php.net/manual/en/function.register-shutdown-function.php
*
* @param mixed $item An item to submit.
* @param int $idNum A numeric id for the job.
* @return void
*/
public function submit($item, $idNum)
{
if (!$this->hasShutdownHookRegistered) {
register_shutdown_function([$this, 'shutdown']);
$this->hasShutdownHookRegistered = true;
}
if (!array_key_exists($idNum, $this->items)) {
$this->items[$idNum] = [];
$this->lastInvoked[$idNum] = $this->created;
}
$this->items[$idNum][] = $item;
$job = $this->config->getJobFromIdNum($idNum);
$batchSize = $job->getBatchSize();
$period = $job->getCallPeriod();
if ((count($this->items[$idNum]) >= $batchSize)
|| (count($this->items[$idNum]) !== 0
&& microtime(true) > $this->lastInvoked[$idNum] + $period)) {
$this->flush($idNum);
$this->items[$idNum] = [];
$this->lastInvoked[$idNum] = microtime(true);
}
}
/**
* Run the job with the given id.
*
* @param int $idNum A numeric id for the job.
* @return bool
*/
public function flush($idNum)
{
if (isset($this->items[$idNum])) {
$job = $this->config->getJobFromIdNum($idNum);
if (!$job->flush($this->items[$idNum])) {
$this->handleFailure($idNum, $this->items[$idNum]);
}
$this->items[$idNum] = [];
$this->lastInvoked[$idNum] = microtime(true);
}
return true;
}
/**
* Run the job for remainder items.
*/
public function shutdown()
{
foreach ($this->items as $idNum => $items) {
if (count($items) !== 0) {
$this->flush($idNum);
}
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/InterruptTrait.php
================================================
shutdown = true;
break;
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/JobConfig.php
================================================
identifierToId)
? $this->jobs[$identifier]
: null;
}
/**
* Get the job with the given numeric id.
*
* @param int $idNum A numeric id of the job.
*
* @return JobInterface|null
*/
public function getJobFromIdNum($idNum)
{
return array_key_exists($idNum, $this->idToIdentifier)
? $this->jobs[$this->idToIdentifier[$idNum]]
: null;
}
/**
* Register a job for executing in batch.
*
* @param string $identifier Unique identifier of the job.
* @param callable $callback Callback that accepts the job $idNum
* and returns a JobInterface instance.
* @return void
*/
public function registerJob($identifier, $callback)
{
if (array_key_exists($identifier, $this->identifierToId)) {
$idNum = $this->identifierToId[$identifier];
} else {
$idNum = count($this->identifierToId) + 1;
$this->idToIdentifier[$idNum] = $identifier;
}
$this->jobs[$identifier] = call_user_func(
$callback,
$idNum
);
$this->identifierToId[$identifier] = $idNum;
}
/**
* Get all the jobs indexed by the job's identifier.
*
* @return array Associative array of JobInterface instances keyed by a
* string identifier.
*/
public function getJobs()
{
return $this->jobs;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/JobInterface.php
================================================
identifier;
}
/**
* Return the job id
*
* @return int
*/
public function id()
{
return $this->id;
}
/**
* Returns the number of workers for this job. **Defaults to* 1.
*
* @return int
*/
public function numWorkers()
{
return $this->numWorkers;
}
/**
* Returns the optional file required to run this job.
*
* @return string|null
*/
public function bootstrapFile()
{
return $this->bootstrapFile;
}
/**
* Runs the job loop. This is expected to be a blocking call.
*/
abstract public function run();
/**
* Finish any pending activity for this job.
*
* @param array $items
* @return bool
*/
public function flush(array $items = [])
{
return false;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/OpisClosureSerializer.php
================================================
runner = $runner ?: new BatchRunner();
$this->initFailureFile();
}
/**
* Retry all the failed items.
*/
public function retryAll()
{
foreach ($this->getFailedFiles() as $file) {
// Rename the file first
$tmpFile = dirname($file) . '/retrying-' . basename($file);
rename($file, $tmpFile);
$fp = @fopen($tmpFile, 'r');
if ($fp === false) {
fwrite(
STDERR,
sprintf('Could not open the file: %s' . PHP_EOL, $tmpFile)
);
continue;
}
while ($line = fgets($fp)) {
$jsonDecodedValue = json_decode($line);
// Check if data json_encoded after serialization
if ($jsonDecodedValue !== null || $jsonDecodedValue !== false) {
$line = $jsonDecodedValue;
}
$a = unserialize($line);
$idNum = key($a);
$job = $this->runner->getJobFromIdNum($idNum);
if (! $job->callFunc($a[$idNum])) {
$this->handleFailure($idNum, $a[$idNum]);
}
}
@fclose($fp);
@unlink($tmpFile);
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/SerializableClientTrait.php
================================================
null,
'clientConfig' => []
];
$this->closureSerializer = $options['closureSerializer']
?? $this->getDefaultClosureSerializer();
$this->setWrappedClientConfig($options);
}
/**
* @param array $options
*/
private function setWrappedClientConfig(array $options)
{
$config = $options['clientConfig'] ?? [];
if ($config && $this->closureSerializer) {
$this->closureSerializer->wrapClosures($config);
}
$this->clientConfig = $config;
}
/**
* @return array
*/
private function getUnwrappedClientConfig()
{
if ($this->clientConfig && $this->closureSerializer) {
$this->closureSerializer->unwrapClosures($this->clientConfig);
}
return $this->clientConfig;
}
/**
* @return ClosureSerializerInterface|null
*/
private function getDefaultClosureSerializer()
{
if (function_exists('Opis\Closure\serialize')) {
return new OpisClosureSerializerV4();
}
if (class_exists(SerializableClosure::class)) {
return new OpisClosureSerializer();
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/SimpleJob.php
================================================
identifier = $identifier;
$this->func = $func;
$this->id = $id;
$options += [
'bootstrapFile' => null,
'numWorkers' => 1
];
$this->numWorkers = $options['numWorkers'];
$this->bootstrapFile = $options['bootstrapFile'];
}
/**
* Runs the job loop. This is expected to be a blocking call.
*/
public function run()
{
if ($this->bootstrapFile) {
require_once $this->bootstrapFile;
}
call_user_func($this->func);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/SimpleJobTrait.php
================================================
null,
];
$this->setSerializableClientOptions($options);
$identifier = $options['identifier'];
$configStorage = $options['configStorage'] ?: $this->defaultConfigStorage();
$result = $configStorage->lock();
if ($result === false) {
return false;
}
$config = $configStorage->load();
$config->registerJob(
$identifier,
function ($id) use ($identifier, $options) {
return new SimpleJob($identifier, [$this, 'run'], $id, $options);
}
);
try {
$result = $configStorage->save($config);
} finally {
$configStorage->unlock();
}
return $result;
}
private function defaultConfigStorage()
{
if ($this->isSysvIPCLoaded() && $this->isDaemonRunning()) {
return new SysvConfigStorage();
} else {
return InMemoryConfigStorage::getInstance();
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/SysvConfigStorage.php
================================================
shmSize = intval(getenv('GOOGLE_CLOUD_BATCH_SHM_SIZE'));
if ($this->shmSize === 0) {
$this->shmSize = self::DEFAULT_SHM_SIZE;
}
$this->perm = octdec(getenv('GOOGLE_CLOUD_BATCH_PERM'));
if ($this->perm === 0) {
$this->perm = self::DEFAULT_PERM;
}
$this->project = getenv('GOOGLE_CLOUD_BATCH_PROJECT');
if ($this->project === false) {
$this->project = self::DEFAULT_PROJECT;
}
$this->sysvKey = ftok(__FILE__, $this->project);
$this->semid = sem_get($this->sysvKey, 1, $this->perm, 1);
}
/**
* Acquire a lock.
*
* @return bool
*/
public function lock()
{
return sem_acquire($this->semid);
}
/**
* Release a lock.
*
* @return bool
*/
public function unlock()
{
return sem_release($this->semid);
}
/**
* Save the given JobConfig.
*
* @param JobConfig $config A JobConfig to save.
* @return bool
* @throws \RuntimeException when failed to attach to the shared memory or serialization fails
*/
public function save(JobConfig $config)
{
$shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm);
if ($shmid === false) {
throw new \RuntimeException(
'Failed to attach to the shared memory'
);
}
// If the variable write fails, clear the memory and re-raise the exception
try {
$result = shm_put_var($shmid, self::VAR_KEY, $config);
} catch (\Exception $e) {
$this->clear();
throw new \RuntimeException($e->getMessage());
} finally {
shm_detach($shmid);
}
return $result;
}
/**
* Load a JobConfig from the storage.
*
* @return JobConfig
* @throws \RuntimeException when failed to attach to the shared memory or deserialization fails
*/
public function load()
{
$shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm);
if ($shmid === false) {
throw new \RuntimeException(
'Failed to attach to the shared memory'
);
}
if (! shm_has_var($shmid, self::VAR_KEY)) {
$result = new JobConfig();
} else {
$result = shm_get_var($shmid, self::VAR_KEY);
}
shm_detach($shmid);
if ($result === false) {
throw new \RuntimeException(
'Failed to deserialize data from shared memory'
);
}
return $result;
}
/**
* Clear the JobConfig from storage.
*/
public function clear()
{
$shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm);
shm_remove_var($shmid, self::VAR_KEY);
}
/**
* Serialize the object
*/
public function __serialize()
{
$vars = get_object_vars($this);
// As of PHP 8.0, "semid" is the unserializable object "SysvSemaphore"
// @see https://github.com/googleapis/google-cloud-php/issues/3749
unset($vars['semid']);
return $vars;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Batch/SysvProcessor.php
================================================
sysvQs)) {
$this->sysvQs[$idNum] =
msg_get_queue($this->getSysvKey($idNum));
}
$result = @msg_send(
$this->sysvQs[$idNum],
self::$typeDirect,
$item,
true,
false
);
if ($result === false) {
// Try to put the content in a temp file and send the filename.
$tempFile = tempnam(sys_get_temp_dir(), 'Item');
$result = file_put_contents($tempFile, serialize($item));
if ($result === false) {
throw new \RuntimeException(
"Failed to write to $tempFile while submiting the item"
);
}
$result = @msg_send(
$this->sysvQs[$idNum],
self::$typeFile,
$tempFile,
true,
false
);
if ($result === false) {
@unlink($tempFile);
throw new QueueOverflowException();
}
}
}
/**
* Run the job with the given id. This has no effect and simply always
* returns false when using the batch daemon.
*
* @param int $idNum A numeric id of the job.
* @return bool
*/
public function flush($idNum)
{
return false;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Blob.php
================================================
value = Utils::streamFor($value);
}
/**
* Get the blob contents as a stream
*
* Example:
* ```
* $value = $blob->get();
* ```
*
* @return StreamInterface
*/
public function get()
{
return $this->value;
}
/**
* Cast the blob to a string
*
* @access private
* @return string
*/
public function __toString()
{
return (string) $this->value;
}
/**
* Implement JsonSerializable by returning a base64 encoded string of the blob
*
* @return string
* @access private
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return base64_encode((string) $this->value);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/ClientTrait.php
================================================
isGrpcLoaded();
$defaultTransport = $isGrpcExtensionLoaded ? 'grpc' : 'rest';
$transport = strtolower($config['transport'] ?? $defaultTransport);
if ($transport === 'grpc') {
if (!$isGrpcExtensionLoaded) {
throw new GoogleException(
'gRPC support has been requested but required dependencies ' .
'have not been found. ' . $this->getGrpcInstallationMessage()
);
}
}
return $transport;
}
/**
* Throw an exception if the gRPC extension is not loaded.
*
* @throws GoogleException
*/
private function requireGrpc()
{
if (!$this->isGrpcLoaded()) {
throw new GoogleException(
'The requested client requires the gRPC extension. ' .
$this->getGrpcInstallationMessage()
);
}
}
/**
* @return string
*/
private function getGrpcInstallationMessage()
{
return 'Please see https://cloud.google.com/php/grpc for installation ' .
'instructions.';
}
/**
* Fetch and validate the keyfile and set the project ID.
*
* @param array $config
* @return array
* @throws GoogleException
*/
private function configureAuthentication(array $config)
{
$credentialsFetcher = $config['credentialsFetcher'] ?? null;
if (!($credentialsFetcher instanceof FetchAuthTokenInterface)) {
$config['keyFile'] = $this->getKeyFile($config);
}
$this->projectId = $this->detectProjectId($config);
return $config;
}
/**
* Get a keyfile if it exists.
*
* Process:
* 1. If $config['keyFile'] is set, use that.
* 2. If $config['keyFilePath'] is set, load the file and use that.
* 3. If GOOGLE_APPLICATION_CREDENTIALS environment variable is set, load
* from that location and use that.
* 4. If OS-specific well-known-file is set, load from that location and use
* that.
*
* @param array $config
* @return array|null Key data
* @throws GoogleException
*/
private function getKeyFile(array $config = [])
{
$config += [
'keyFile' => null,
'keyFilePath' => null,
];
if ($config['keyFile']) {
return $config['keyFile'];
}
if ($config['keyFilePath']) {
if (!file_exists($config['keyFilePath'])) {
throw new GoogleException(sprintf(
'Given keyfile path %s does not exist',
$config['keyFilePath']
));
}
try {
$keyFileData = $this->jsonDecode(file_get_contents($config['keyFilePath']), true);
} catch (\InvalidArgumentException $ex) {
throw new GoogleException(sprintf(
'Given keyfile at path %s was invalid',
$config['keyFilePath']
));
}
return $keyFileData;
}
return CredentialsLoader::fromEnv()
?: CredentialsLoader::fromWellKnownFile();
}
/**
* Detect and return a project ID.
*
* Process:
* 1. If $config['projectId'] is set, use that.
* 2. If an emulator is enabled, return a dummy value.
* 3. If $config['keyFile'] is set, attempt to retrieve a project ID from
* that.
* 4. Check `GOOGLE_CLOUD_PROJECT` environment variable.
* 5. Check `GCLOUD_PROJECT` environment variable.
* 6. If code is running on compute engine, try to get the project ID from
* the metadata store.
* 7. Throw exception.
*
* @param array $config
* @return string
* @throws GoogleException
*/
private function detectProjectId(array $config)
{
$config += [
'credentialsFetcher' => null,
'httpHandler' => null,
'projectId' => null,
'projectIdRequired' => false,
'hasEmulator' => false,
'preferNumericProjectId' => false,
'suppressKeyFileNotice' => false
];
if ($config['projectId']) {
return $config['projectId'];
}
if ($config['hasEmulator']) {
return 'emulator-project';
}
if ($config['credentialsFetcher'] instanceof ProjectIdProviderInterface) {
return $config['credentialsFetcher']->getProjectId();
}
if (isset($config['keyFile'])) {
if (isset($config['keyFile']['project_id'])) {
return $config['keyFile']['project_id'];
}
if ($config['suppressKeyFileNotice'] !== true) {
$serviceAccountUri = 'https://cloud.google.com/iam/docs/' .
'creating-managing-service-account-keys#creating_service_account_keys';
trigger_error(
sprintf(
'A keyfile was given, but it does not contain a project ' .
'ID. This can indicate an old and obsolete keyfile, ' .
'in which case you should create a new one. To suppress ' .
'this message, set `suppressKeyFileNotice` to `true` in your client configuration. ' .
'To learn more about generating new keys, see this URL: %s',
$serviceAccountUri
),
E_USER_NOTICE
);
}
}
if (getenv('GOOGLE_CLOUD_PROJECT')) {
return getenv('GOOGLE_CLOUD_PROJECT');
}
if (getenv('GCLOUD_PROJECT')) {
return getenv('GCLOUD_PROJECT');
}
if ($this->onGce($config['httpHandler'])) {
$metadata = $this->getMetaData();
$projectId = $config['preferNumericProjectId']
? $metadata->getNumericProjectId()
: $metadata->getProjectId();
if ($projectId) {
return $projectId;
}
}
if ($config['projectIdRequired']) {
throw new GoogleException(
'No project ID was provided, ' .
'and we were unable to detect a default project ID.'
);
}
return '';
}
/**
* Abstract the GCECredentials call so we can mock it in the unit tests!
*
* @codeCoverageIgnore
* @return bool
*/
protected function onGce($httpHandler)
{
return GCECredentials::onGce($httpHandler);
}
/**
* Abstract the Metadata instantiation for unit testing
*
* @codeCoverageIgnore
* @return Metadata
*/
protected function getMetaData()
{
return new Metadata();
}
/**
* Abstract the checking of the grpc extension for unit testing.
*
* @codeCoverageIgnore
* @return bool
*/
protected function isGrpcLoaded()
{
return extension_loaded('grpc');
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Compute/Metadata/Readers/HttpHandlerReader.php
================================================
httpHandler = $httpHandler
?: HttpHandlerFactory::build(HttpClientCache::getHttpClient());
}
/**
* Read the metadata for a given path.
*
* @param string $path The metadata path, relative to `/computeMetadata/v1/`.
* @return string
*/
public function read($path)
{
$url = sprintf(
'http://%s/computeMetadata/v1/%s',
GCECredentials::METADATA_IP,
$path
);
$request = new Request('GET', $url, [
GCECredentials::FLAVOR_HEADER => 'Google'
]);
$handler = $this->httpHandler;
$res = $handler($request);
return (string) $res->getBody();
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Compute/Metadata/Readers/ReaderInterface.php
================================================
[
'method' => 'GET',
'header' => GCECredentials::FLAVOR_HEADER . ': Google'
],
];
$this->context = $this->createStreamContext($options);
}
/**
* Read the metadata for a given path.
*
* @param string $path The metadata path, relative to `/computeMetadata/v1/`.
* @return string
*/
public function read($path)
{
$url = sprintf(
'http://%s/computeMetadata/v1/%s',
GCECredentials::METADATA_IP,
$path
);
return $this->getMetadata($url);
}
/**
* Abstracted for testing.
*
* @param array $options
* @return resource
* @codeCoverageIgnore
*/
protected function createStreamContext(array $options)
{
return stream_context_create($options);
}
/**
* Abstracted for testing.
*
* @param string $url
* @return string
* @codeCoverageIgnore
*/
protected function getMetadata($url)
{
return file_get_contents($url, false, $this->context);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Compute/Metadata.php
================================================
getProjectId();
* ```
*
* ```
* // It is easy to get any metadata from a project.
* $val = $metadata->getProjectMetadata($key);
* ```
*/
class Metadata
{
/**
* @var ReaderInterface The metadata reader.
*/
private $reader;
/**
* @var string The project id.
*/
private $projectId;
/**
* @var int The numeric project id.
*/
private $numericProjectId;
/**
* @param ReaderInterface $reader [optional] A metadata reader implementation.
*/
public function __construct(?ReaderInterface $reader = null)
{
$this->reader = $reader ?: new HttpHandlerReader();
}
/**
* Replace the default reader implementation
*
* @deprecated If a custom reader implementation is desired, provide it at
* construction.
* @param ReaderInterface $reader The reader implementation
*/
public function setReader(ReaderInterface $reader)
{
$this->reader = $reader;
}
/**
* Fetch a metadata item by its path
*
* Example:
* ```
* $projectId = $metadata->get('project/project-id');
* ```
*
* @param string $path The path of the item to retrieve.
*/
public function get($path)
{
return $this->reader->read($path);
}
/**
* Detect and return the project ID
*
* Example:
* ```
* $projectId = $metadata->getProjectId();
* ```
*
* @return string
*/
public function getProjectId()
{
if (!isset($this->projectId)) {
$this->projectId = $this->get('project/project-id');
}
return $this->projectId;
}
/**
* Detect and return the numeric project ID
*
* Example:
* ```
* $projectId = $metadata->getNumericProjectId();
* ```
*
* @return string
*/
public function getNumericProjectId()
{
if (!isset($this->numericProjectId)) {
$this->numericProjectId = $this->get('project/numeric-project-id');
}
return $this->numericProjectId;
}
/**
* Fetch an item from the project metadata
*
* Example:
* ```
* $foo = $metadata->getProjectMetadata('foo');
* ```
*
* @param string $key The metadata key
* @return string
*/
public function getProjectMetadata($key)
{
$path = 'project/attributes/' . $key;
return $this->get($path);
}
/**
* Fetch an item from the instance metadata
*
* Example:
* ```
* $foo = $metadata->getInstanceMetadata('foo');
* ```
*
* @param string $key The instance metadata key
* @return string
*/
public function getInstanceMetadata($key)
{
$path = 'instance/attributes/' . $key;
return $this->get($path);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/ConcurrencyControlTrait.php
================================================
connection)) {
$props['connection'] = get_class($this->connection);
}
if (isset($props['__excludeFromDebug'])) {
$exclude = $props['__excludeFromDebug'];
unset($props['__excludeFromDebug']);
foreach ($exclude as $e) {
unset($props[$e]);
}
}
return $props;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/DetectProjectIdTrait.php
================================================
null,
'projectId' => null,
'projectIdRequired' => false,
'hasEmulator' => false,
'credentials' => null,
];
if ($config['projectId']) {
return $config['projectId'];
}
if ($config['hasEmulator']) {
return 'emulator-project';
}
if ($config['credentials']
&& $config['credentials'] instanceof ProjectIdProviderInterface
&& $projectId = $config['credentials']->getProjectId()) {
return $projectId;
}
if (getenv('GOOGLE_CLOUD_PROJECT')) {
return getenv('GOOGLE_CLOUD_PROJECT');
}
if (getenv('GCLOUD_PROJECT')) {
return getenv('GCLOUD_PROJECT');
}
$this->throwExceptionIfProjectIdRequired($config);
return '';
}
/**
* Throws an exception if project id is required.
* @param array $config
* @throws GoogleException
*/
private function throwExceptionIfProjectIdRequired(array $config)
{
if ($config['projectIdRequired']) {
throw new GoogleException(
'No project ID was provided, ' .
'and we were unable to detect a default project ID.'
);
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Duration.php
================================================
seconds = $seconds;
$this->nanos = $nanos;
}
/**
* Get the duration
*
* Example:
* ```
* $res = $duration->get();
* ```
*
* @return array
*/
public function get()
{
return [
'seconds' => $this->seconds,
'nanos' => $this->nanos
];
}
/**
* Format the value as a string.
*
* Example:
* ```
* echo $duration->formatAsString();
* ```
*
* @return string
*/
public function formatAsString()
{
return json_encode($this->get());
}
/**
* Format the value as a string.
*
* @return string
* @access private
*/
public function __toString()
{
return $this->formatAsString();
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/EmulatorTrait.php
================================================
$emulatorHost,
'credentials' => new InsecureCredentialsWrapper(),
];
if (class_exists('Grpc\ChannelCredentials')) {
$config['transportConfig'] = [
'grpc' => [
'stubOpts' => [
'credentials' => \Grpc\ChannelCredentials::createInsecure()
]
]
];
}
return $config;
}
/**
* Retrieve a valid base uri for a service emulator.
*
* @param string $emulatorHost
* @return string
*/
private function emulatorBaseUri($emulatorHost)
{
$emulatorUriComponents = parse_url($emulatorHost);
$emulatorUriComponents = array_merge(['scheme' => 'http', 'port' => ''], $emulatorUriComponents);
$baseUri = "{$emulatorUriComponents['scheme']}://{$emulatorUriComponents['host']}";
$baseUri .= $emulatorUriComponents['port'] ? ":{$emulatorUriComponents['port']}/" : '/';
return $baseUri;
}
/**
* When emulators are enabled, use them as the service host.
*
* This method is deprecated and will be removed in a future major release.
*
* @param string $baseUri
* @param string $emulatorHost [optional]
* @return string
*
* @deprecated
* @access private
*/
public function getEmulatorBaseUri($baseUri, $emulatorHost = null)
{
if ($emulatorHost) {
$baseUri = $this->emulatorBaseUri($emulatorHost);
}
return $baseUri;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Exception/AbortedException.php
================================================
message = $message;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Exception/ServerException.php
================================================
serviceException = $serviceException;
$this->metadata = $metadata;
$this->errorInfo = null;
$this->errorInfoMetadata = null;
$this->errorReason = null;
parent::__construct($message ?: '', $code);
}
/**
* If $serviceException is set, return true.
*
* @return bool
*/
public function hasServiceException()
{
return (bool) $this->serviceException;
}
/**
* Return the service exception object.
*
* @return Exception|null
*/
public function getServiceException()
{
return $this->serviceException;
}
/**
* Get exception metadata.
*/
public function getMetadata()
{
return $this->metadata;
}
/**
* Returns the metadata from the ErrorInfo part of the exception
*
* @return array
*/
public function getErrorInfoMetadata()
{
// Only calc the metadata if we haven't cached it
if (is_null($this->errorInfoMetadata)) {
// For response originated from the GAPIC layer, the current exception would have
// an ApiException within itself
if ($this->getServiceException() instanceof ApiException) {
return $this->getServiceException()->getErrorInfoMetadata();
}
$errorInfo = $this->getErrorInfoFromRestException();
// Cache the result to be reused if needed
$this->errorInfoMetadata = $errorInfo['metadata'] ?? [];
}
return $this->errorInfoMetadata;
}
/**
* Returns the reason from the ErrorInfo part of the exception
*
* @return string
*/
public function getReason()
{
// Only calc the errorReason if we haven't cached it
if (is_null($this->errorReason)) {
// For a response originated from the GAPIC layer, the current exception would have
// an ApiException within itself
if ($this->getServiceException() instanceof ApiException) {
return $this->getServiceException()->getReason();
}
$errorInfo = $this->getErrorInfoFromRestException();
// Cache the result to be reused if needed
$this->errorReason = $errorInfo['reason'] ?? '';
}
return $this->errorReason;
}
/**
* Return the delay in seconds and nanos before retrying the failed request.
*
* @return array
*/
public function getRetryDelay()
{
$metadata = array_filter($this->metadata, function ($metadataItem) {
return array_key_exists('retryDelay', $metadataItem);
});
if (count($metadata) === 0) {
return ['seconds' => 0, 'nanos' => 0];
}
return $metadata[0]['retryDelay'] + [
'seconds' => 0,
'nanos' => 0
];
}
/**
* Helper to return the error info from an exception
* which is not raised from the GAPIC layer
*
* @return array
*/
private function getErrorInfoFromRestException()
{
// Only calc errorInfo if it isn't cached
if (is_null($this->errorInfo)) {
$this->errorInfo = [];
$arr = json_decode($this->getMessage(), true);
if (!isset($arr['error']['details'])) {
return $this->errorInfo;
}
foreach ($arr['error']['details'] as $row) {
if (isset($row['@type']) && $row['@type'] === self::ERRORINFO_TYPE_REST) {
// save this in cache
$this->errorInfo = $row;
break;
}
}
}
return $this->errorInfo;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/ExponentialBackoff.php
================================================
retries = $retries !== null ? (int) $retries : 3;
$this->retryFunction = $retryFunction;
$this->retryListener = $retryListener;
// @todo revisit this approach
// @codeCoverageIgnoreStart
$this->delayFunction = static function ($delay) {
usleep($delay);
};
// @codeCoverageIgnoreEnd
}
/**
* Executes the retry process.
*
* @param callable $function
* @param array $arguments [optional]
* @return mixed
* @throws \Exception The last exception caught while retrying.
*/
public function execute(callable $function, array $arguments = [])
{
$delayFunction = $this->delayFunction;
$calcDelayFunction = $this->calcDelayFunction ?: [$this, 'calculateDelay'];
$retryAttempt = 0;
$exception = null;
while (true) {
try {
return call_user_func_array($function, $arguments);
} catch (\Exception $exception) {
if ($this->retryFunction) {
if (!call_user_func($this->retryFunction, $exception, $retryAttempt)) {
throw $exception;
}
}
if ($retryAttempt >= $this->retries) {
break;
}
$delayFunction($calcDelayFunction($retryAttempt));
$retryAttempt++;
if ($this->retryListener) {
// Developer can modify the $arguments using the retryListener
// callback.
call_user_func_array(
$this->retryListener,
[$exception, $retryAttempt, &$arguments]
);
}
}
}
throw $exception;
}
/**
* If not set, defaults to using `usleep`.
*
* @param callable $delayFunction
* @return void
*/
public function setDelayFunction(callable $delayFunction)
{
$this->delayFunction = $delayFunction;
}
/**
* If not set, defaults to using
* {@see \Google\Cloud\Core\ExponentialBackoff::calculateDelay()}.
*
* @param callable $calcDelayFunction
* @return void
*/
public function setCalcDelayFunction(callable $calcDelayFunction)
{
$this->calcDelayFunction = $calcDelayFunction;
}
/**
* Calculates exponential delay.
*
* @param int $attempt The attempt number used to calculate the delay.
* @return int
*/
public static function calculateDelay($attempt)
{
return min(
mt_rand(0, 1000000) + (pow(2, $attempt) * 1000000),
self::MAX_DELAY_MICROSECONDS
);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/GeoPoint.php
================================================
latitude = $this->validateValue($latitude, 'latitude', $allowNull);
$this->longitude = $this->validateValue($longitude, 'longitude', $allowNull);
}
/**
* Get the latitude
*
* Example:
* ```
* $latitude = $point->latitude();
* ```
*
* @return float|null
*/
public function latitude()
{
$this->checkContext('latitude', func_get_args());
return $this->latitude;
}
/**
* Set the latitude
*
* Non-numeric values will result in an exception
*
* Example:
* ```
* $point->setLatitude(42.279594);
* ```
*
* @param int|float $latitude The new latitude
* @return GeoPoint
* @throws \InvalidArgumentException
*/
public function setLatitude($latitude)
{
$this->latitude = $this->validateValue($latitude, 'latitude');
return $this;
}
/**
* Get the longitude
*
* Example:
* ```
* $longitude = $point->longitude();
* ```
*
* @return float|null
*/
public function longitude()
{
$this->checkContext('longitude', func_get_args());
return $this->longitude;
}
/**
* Set the longitude
*
* Non-numeric values will result in an exception.
*
* Example:
* ```
* $point->setLongitude(-83.732124);
* ```
*
* @param float|int $longitude The new longitude value
* @return GeoPoint
* @throws \InvalidArgumentException
*/
public function setLongitude($longitude)
{
$this->longitude = $this->validateValue($longitude, 'longitude');
return $this;
}
/**
* Return a GeoPoint
*
* Example:
* ```
* $point = $point->point();
* ```
*
* @return array [LatLng](https://cloud.google.com/datastore/reference/rest/Shared.Types/LatLng)
*/
public function point()
{
return [
'latitude' => $this->latitude,
'longitude' => $this->longitude
];
}
/**
* Let people know if they accidentally use the getter in setter context.
*
* @param string $method the method name
* @param array $args The method arguments
* @throws \InvalidArgumentException
* @return void
*/
private function checkContext($method, array $args)
{
if (count($args) > 0) {
throw new InvalidArgumentException(sprintf(
'Calling method %s with arguments is unsupported.',
$method
));
}
}
/**
* Check a given value's validity as a coordinate.
*
* Numeric values will be cast to type `float`. All other values will raise
* an exception with the exception of `null`, if `$allowNull` is set to true.
*
* @param mixed $value The coordinate value.
* @param string $type The coordinate type for error reporting.
* @param bool $allowNull [optional] Whether null values should be allowed.
* **Defaults to** `false`.
* @return float|null
*/
private function validateValue($value, $type, $allowNull = false)
{
if (!is_numeric($value) && (!$allowNull || ($allowNull && $value !== null))) {
throw new InvalidArgumentException(sprintf(
'Given %s must be a numeric value.',
$type
));
}
return $allowNull && $value === null
? $value
: (float) $value;
}
/**
* Implement JsonSerializable by representing GeoPoint as a JSON-object:
*
* ```
* {
* latitude: 31.778333
* longitude: 35.229722
* }
* ```
*
* @return object
* @access private
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return (object) $this->point();
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/GrpcRequestWrapper.php
================================================
setCommonDefaults($config);
$config += [
'authHttpHandler' => null,
'serializer' => new Serializer(),
'grpcOptions' => []
];
$this->authHttpHandler = $config['authHttpHandler'] ?: HttpHandlerFactory::build();
$this->serializer = $config['serializer'];
$this->grpcOptions = $config['grpcOptions'];
}
/**
* Deliver the request.
*
* @param callable $request The request to execute.
* @param array $args The arguments for the request.
* @param array $options [optional] {
* Request options.
*
* @type float $requestTimeout Seconds to wait before timing out the
* request. **Defaults to** `60`.
* @type int $retries Number of retries for a failed request.
* **Defaults to** `3`.
* @type callable $grpcRetryFunction Sets the conditions for whether or
* not a request should attempt to retry. Function signature should
* match: `function (\Exception $ex) : bool`.
* @type array $grpcOptions gRPC specific configuration options.
* }
* @return array
* @throws Exception\ServiceException
*/
public function send(callable $request, array $args, array $options = [])
{
$retries = $options['retries'] ?? $this->retries;
$retryFunction = $options['grpcRetryFunction']
?? function (\Exception $ex) {
$statusCode = $ex->getCode();
return in_array($statusCode, $this->grpcRetryCodes);
};
$grpcOptions = $options['grpcOptions'] ?? $this->grpcOptions;
$timeout = $options['requestTimeout'] ?? $this->requestTimeout;
$backoff = new ExponentialBackoff($retries, $retryFunction);
if (!isset($grpcOptions['retrySettings'])) {
$retrySettings = [
'retriesEnabled' => false
];
if ($timeout) {
$retrySettings['noRetriesRpcTimeoutMillis'] = $timeout * 1000;
}
$grpcOptions['retrySettings'] = $retrySettings;
}
$optionalArgs = &$args[count($args) - 1];
$optionalArgs += $grpcOptions;
try {
return $this->handleResponse($backoff->execute($request, $args));
} catch (\Exception $ex) {
if ($ex instanceof ApiException) {
throw $this->convertToGoogleException($ex);
}
throw $ex;
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/GrpcTrait.php
================================================
requestWrapper = $requestWrapper;
}
/**
* Get the GrpcRequestWrapper.
*
* @return GrpcRequestWrapper|null
*/
public function requestWrapper()
{
return $this->requestWrapper;
}
/**
* Delivers a request.
*
* @param callable $request
* @param array $args
* @param bool $whitelisted
* @return \Generator|array
* @throws ServiceException
*/
public function send(callable $request, array $args, $whitelisted = false)
{
$requestOptions = $this->pluckArray([
'grpcOptions',
'retries',
'requestTimeout',
'grpcRetryFunction'
], $args[count($args) - 1]);
try {
return $this->requestWrapper->send($request, $args, $requestOptions);
} catch (NotFoundException $e) {
if ($whitelisted) {
throw $this->modifyWhitelistedError($e);
}
throw $e;
}
}
/**
* Gets the default configuration for generated clients.
*
* @param string $version
* @param callable|null $authHttpHandler
* @param string|null $universeDomain
* @return array
*/
private function getGaxConfig(
$version,
?callable $authHttpHandler = null,
?string $universeDomain = null
) {
$config = [
'libName' => 'gccl',
'libVersion' => $version,
'transport' => 'grpc'
];
// GAX v0.32.0 introduced the CredentialsWrapper class and a different
// way to configure credentials. If the class exists, use this new method
// otherwise default to legacy usage.
if (class_exists(CredentialsWrapper::class)) {
$config['credentials'] = new CredentialsWrapper(
$this->requestWrapper->getCredentialsFetcher(),
$authHttpHandler,
// If the universe domain hasn't been explicitly set, check the the environment variable,
// otherwise assume GDU ("googleapis.com").
$universeDomain
?: getenv('GOOGLE_CLOUD_UNIVERSE_DOMAIN')
?: GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN
);
} else {
$config += [
'credentialsLoader' => $this->requestWrapper->getCredentialsFetcher(),
'authHttpHandler' => $authHttpHandler,
'enableCaching' => false
];
}
return $config;
}
use TimeTrait;
/**
* Format a struct for the API.
*
* @param array $fields
* @return array
*/
private function formatStructForApi(array $fields)
{
$fFields = [];
foreach ($fields as $key => $value) {
$fFields[$key] = $this->formatValueForApi($value);
}
return ['fields' => $fFields];
}
private function unpackStructFromApi(array $struct)
{
$vals = [];
foreach ($struct['fields'] as $key => $val) {
$vals[$key] = $this->unpackValue($val);
}
return $vals;
}
private function unpackValue($value)
{
if (count($value) > 1) {
throw new \RuntimeException("Unexpected fields in struct: $value");
}
foreach ($value as $setField => $setValue) {
switch ($setField) {
case 'listValue':
$valueList = [];
foreach ($setValue['values'] as $innerValue) {
$valueList[] = $this->unpackValue($innerValue);
}
return $valueList;
case 'structValue':
return $this->unpackStructFromApi($value['structValue']);
default:
return $setValue;
}
}
}
private function flattenStruct(array $struct)
{
return $struct['fields'];
}
private function flattenValue(array $value)
{
if (count($value) > 1) {
throw new \RuntimeException("Unexpected fields in struct: $value");
}
if (isset($value['nullValue'])) {
return null;
}
return array_pop($value);
}
private function flattenListValue(array $value)
{
return $value['values'];
}
/**
* Format a list for the API.
*
* @param array $list
* @return array
*/
private function formatListForApi(array $list)
{
$values = [];
foreach ($list as $value) {
$values[] = $this->formatValueForApi($value);
}
return ['values' => $values];
}
/**
* Format a value for the API.
*
* @param mixed $value
* @return array
*/
private function formatValueForApi($value)
{
$type = gettype($value);
switch ($type) {
case 'string':
return ['string_value' => $value];
case 'double':
case 'integer':
return ['number_value' => $value];
case 'boolean':
return ['bool_value' => $value];
case 'NULL':
return ['null_value' => NullValue::NULL_VALUE];
case 'array':
if (!empty($value) && $this->isAssoc($value)) {
return ['struct_value' => $this->formatStructForApi($value)];
}
return ['list_value' => $this->formatListForApi($value)];
}
return [];
}
/**
* Format a gRPC timestamp to match the format returned by the REST API.
*
* @param array $timestamp
* @return string
*/
private function formatTimestampFromApi(array $timestamp)
{
$timestamp += [
'seconds' => 0,
'nanos' => 0
];
$dt = $this->createDateTimeFromSeconds($timestamp['seconds']);
return $this->formatTimeAsString($dt, $timestamp['nanos']);
}
/**
* Format a timestamp for the API with nanosecond precision.
*
* @param string $value
* @return array
*/
private function formatTimestampForApi($value)
{
list($dt, $nanos) = $this->parseTimeString($value);
return [
'seconds' => (int) $dt->format('U'),
'nanos' => (int) $nanos
];
}
/**
* Format a duration for the API.
*
* @param string|mixed $value
* @return array
*/
private function formatDurationForApi($value)
{
if (is_string($value)) {
$d = explode('.', trim($value, 's'));
if (count($d) < 2) {
$seconds = $d[0];
$nanos = 0;
} else {
$seconds = (int) $d[0];
$nanos = $this->convertFractionToNanoSeconds($d[1]);
}
} elseif ($value instanceof Duration) {
$d = $value->get();
$seconds = $d['seconds'];
$nanos = $d['nanos'];
}
return [
'seconds' => $seconds,
'nanos' => $nanos
];
}
/**
* Format a duration from the API
*
* @param array $value
* @return string
*/
private function formatDurationFromApi($value): string
{
$seconds = $value['seconds'];
$nanos = str_pad($value['nanos'], 9, 0, STR_PAD_LEFT);
return "{$seconds}.{$nanos}s";
}
/**
* Construct a gapic client. Allows for tests to intercept.
*
* @param string $gapicName
* @param array $config
* @return mixed
*/
protected function constructGapic($gapicName, array $config)
{
return new $gapicName($config);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Iam/Iam.php
================================================
'my-project']);
* $instance = $spanner->instance('my-new-instance');
*
* $iam = $instance->iam();
* ```
*/
class Iam
{
/**
* @var IamConnectionInterface
*/
private $connection;
/**
* @var string
*/
private $resource;
/**
* @var array
*/
private $policy;
/**
* @var array
*/
private $args;
/**
* @var array
*/
private $options;
/**
* @param IamConnectionInterface $connection
* @param string $resource
* @param array $options [optional] {
* Configuration Options
*
* @type string|null $parent The parent request parameter for the policy.
* If set, policy data will be sent as `request.{$parent}`.
* Otherwise, policy will be sent in request root. **Defaults to**
* `policy`.
* @type array $args Arbitrary data to be sent with the request.
* }
* @access private
*/
public function __construct(IamConnectionInterface $connection, $resource, array $options = [])
{
$options += [
'parent' => 'policy',
'args' => []
];
$this->connection = $connection;
$this->resource = $resource;
$this->options = $options;
}
/**
* Get the existing IAM policy for this resource.
*
* If a policy has already been retrieved from the API, it will be returned.
* To fetch a fresh copy of the policy, use
* {@see \Google\Cloud\Core\Iam\Iam::reload()}.
*
* Example:
* ```
* $policy = $iam->policy();
* ```
*
* @param array $options Configuration Options
* @param int $options['requestedPolicyVersion'] Specify the policy version to
* request from the server. Please see
* [policy versioning](https://cloud.google.com/iam/docs/policies#versions)
* for more information.
* @return array An array of policy data
*/
public function policy(array $options = [])
{
if (!$this->policy) {
$this->reload($options);
}
return $this->policy;
}
/**
* Set the IAM policy for this resource.
*
* Bindings with invalid roles, or non-existent members will raise a server
* error.
*
* Example:
* ```
* $oldPolicy = $iam->policy();
* $oldPolicy['bindings'][0]['members'] = 'user:test@example.com';
*
* $policy = $iam->setPolicy($oldPolicy);
* ```
*
* @param array|PolicyBuilder $policy The new policy, as an array or an
* instance of {@see \Google\Cloud\Core\Iam\PolicyBuilder}.
* @param array $options Configuration Options
* @return array An array of policy data
* @throws \InvalidArgumentException If the given policy is not an array or PolicyBuilder.
*/
public function setPolicy($policy, array $options = [])
{
if ($policy instanceof PolicyBuilder) {
$policy = $policy->result();
}
if (!is_array($policy)) {
throw new \InvalidArgumentException('Given policy data must be an array or an instance of PolicyBuilder.');
}
$request = [];
if ($this->options['parent']) {
$parent = $this->options['parent'];
$request[$parent] = $policy;
} else {
$request = $policy;
}
return $this->policy = $this->connection->setPolicy([
'resource' => $this->resource
] + $request + $options + $this->options['args']);
}
/**
* Test if the current user has the given permissions on this resource.
*
* Invalid permissions will raise a BadRequestException.
*
* Example:
* ```
* $allowedPermissions = $iam->testPermissions([
* 'pubsub.topics.publish',
* 'pubsub.topics.attachSubscription'
* ]);
* ```
*
* @param array $permissions A list of permissions to test
* @param array $options Configuration Options
* @return array A subset of $permissions, with only those allowed included.
*/
public function testPermissions(array $permissions, array $options = [])
{
$res = $this->connection->testPermissions([
'permissions' => $permissions,
'resource' => $this->resource
] + $options + $this->options['args']);
return (isset($res['permissions'])) ? $res['permissions'] : [];
}
/**
* Refresh the IAM policy for this resource.
*
* Example:
* ```
* $policy = $iam->reload();
* ```
*
* @param array $options Configuration Options
* @return array An array of policy data
*/
public function reload(array $options = [])
{
return $this->policy = $this->connection->getPolicy([
'resource' => $this->resource
] + $options + $this->options['args']);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Iam/IamConnectionInterface.php
================================================
topic('my-new-topic');
*
* $iam = $topic->iam();
* ```
*
* @internal
*/
class IamManager
{
use ArrayTrait;
private RequestHandler $requestHandler;
private Serializer $serializer;
private string $clientClass;
private string $resource;
private ?array $policy;
/**
* @param RequestHandler $requestHandler
* @param Serializer $serializer The serializer instance to encode/decode messages.
* @param string $clientClass The client class that will be passed on to the
* sendRequest method of the $requestHandler.
* @param string $resource
* @access private
*/
public function __construct(
RequestHandler $requestHandler,
Serializer $serializer,
string $clientClass,
string $resource
) {
$this->requestHandler = $requestHandler;
$this->serializer = $serializer;
$this->clientClass = $clientClass;
$this->resource = $resource;
$this->policy = null;
}
/**
* Get the existing IAM policy for this resource.
*
* If a policy has already been retrieved from the API, it will be returned.
* To fetch a fresh copy of the policy, use
* {@see IamManager::reload()}.
*
* Example:
* ```
* $policy = $iam->policy();
* ```
*
* @param array $options Configuration Options
* @param int $options['requestedPolicyVersion'] Specify the policy version to
* request from the server. Please see
* [policy versioning](https://cloud.google.com/iam/docs/policies#versions)
* for more information.
* @return array An array of policy data
*/
public function policy(array $options = [])
{
if (!$this->policy) {
$this->reload($options);
}
return $this->policy;
}
/**
* Set the IAM policy for this resource.
*
* Bindings with invalid roles, or non-existent members will raise a server
* error.
*
* Example:
* ```
* $policy = [
* 'bindings' => [[
* 'role' => 'roles/editor',
* 'members' => ['user:test@example.com'],
* ]]
* ];
* $policy = $iam->setPolicy($policy);
* ```
* ```
* $oldPolicy = $iam->policy();
* $oldPolicy['bindings'][0]['members'] = 'user:test@example.com';
*
* $policy = $iam->setPolicy($oldPolicy);
* ```
*
* @param array|PolicyBuilder $policy The new policy, as an array or an
* instance of {@see PolicyBuilder}.
* @param array $options Configuration Options
* @return array An array of policy data
* @throws InvalidArgumentException If the given policy is not an array or PolicyBuilder.
*/
public function setPolicy($policy, array $options = [])
{
if ($policy instanceof PolicyBuilder) {
$policy = $policy->result();
}
if (!is_array($policy)) {
throw new InvalidArgumentException('Given policy data must be an array or an instance of PolicyBuilder.');
}
$policy = $this->serializer->decodeMessage(
new Policy(),
$policy
);
$updateMask = $options['updateMask'] ?? [];
$data = ['resource' => $this->resource, 'policy' => $policy, 'updateMask' => $updateMask];
$request = $this->serializer->decodeMessage(new SetIamPolicyRequest(), $data);
$this->policy = $this->requestHandler->sendRequest(
$this->clientClass,
'setIamPolicy',
$request,
$options
);
return $this->policy;
}
/**
* Test if the current user has the given permissions on this resource.
*
* Invalid permissions will raise a BadRequestException.
*
* Example:
* ```
* $allowedPermissions = $iam->testPermissions([
* 'pubsub.topics.publish',
* 'pubsub.topics.attachSubscription'
* ]);
* ```
*
* @param array $permissions A list of permissions to test
* @param array $options Configuration Options
* @return array A subset of $permissions, with only those allowed included.
*/
public function testPermissions(array $permissions, array $options = [])
{
$data = ['resource' => $this->resource, 'permissions' => $permissions];
$request = $this->serializer->decodeMessage(new TestIamPermissionsRequest(), $data);
$res = $this->requestHandler->sendRequest(
$this->clientClass,
'testIamPermissions',
$request,
$options
);
return isset($res['permissions']) ? $res['permissions'] : [];
}
/**
* Refresh the IAM policy for this resource.
*
* Example:
* ```
* $policy = $iam->reload();
* ```
*
* @param array $options Configuration Options
* @return array An array of policy data
*/
public function reload(array $options = [])
{
$policyOptions = $this->pluck('policyOptions', $options, false) ?: [];
$policyOptions = $this->serializer->decodeMessage(new GetPolicyOptions(), $policyOptions);
$data = ['resource' => $this->resource, 'options' => $policyOptions];
$request = $this->serializer->decodeMessage(new GetIamPolicyRequest(), $data);
$this->policy = $this->requestHandler->sendRequest(
$this->clientClass,
'getIamPolicy',
$request,
$options
);
return $this->policy;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Iam/PolicyBuilder.php
================================================
addBinding('roles/admin', [ 'user:admin@domain.com' ]);
* $result = $builder->result();
* ```
*/
class PolicyBuilder
{
/**
* @var array
*/
private $bindings;
/**
* @var string
*/
private $etag;
/**
* @var int
*/
private $version;
/**
* Create a PolicyBuilder.
*
* To use conditions in the bindings, the version of the policy must be set
* to 3.
*
* @see https://cloud.google.com/iam/docs/policies#versions Policy versioning
* @see https://cloud-dot-devsite.googleplex.com/storage/docs/access-control/using-iam-permissions#conditions-iam
* Using Cloud IAM Conditions on buckets
*
* Example:
* ```
* $policy = [
* 'etag' => 'AgIc==',
* 'version' => 3,
* 'bindings' => [
* [
* 'role' => 'roles/admin',
* 'members' => [
* 'user:admin@domain.com',
* 'user2:admin@domain.com'
* ],
* 'condition' => [
* 'title' => 'match-prefix',
* 'description' => 'Applies to objects matching a prefix',
* 'expression' =>
* 'resource.name.startsWith("projects/_/buckets/bucket-name/objects/prefix-a-")'
* ]
* ]
* ],
* ];
*
* $builder = new PolicyBuilder($policy);
* ```
*
* @param array $policy A policy array
* @throws \InvalidArgumentException
*/
public function __construct(array $policy = [])
{
if (isset($policy['bindings'])) {
$this->setBindings($policy['bindings']);
} elseif (!empty($policy)) {
throw new InvalidArgumentException('Invalid Policy');
}
if (isset($policy['etag'])) {
$this->setEtag($policy['etag']);
}
if (isset($policy['version'])) {
$this->setVersion($policy['version']);
}
}
/**
* Override all stored bindings on the policy.
*
* Example:
* ```
* $builder->setBindings([
* [
* 'role' => 'roles/admin',
* 'members' => [
* 'user:admin@domain.com'
* ],
* 'condition' => [
* 'expression' =>
* 'request.time < timestamp("2020-07-01T00:00:00.000Z")'
* ]
* ]
* ]);
* ```
*
* @param array $bindings [optional] An array of bindings
* @return PolicyBuilder
* @throws \InvalidArgumentException
*/
public function setBindings(array $bindings = [])
{
$this->bindings = $bindings;
return $this;
}
/**
* Add a new binding to the policy.
*
* This method will fail with an InvalidOpereationException if it is
* called on a Policy with a version greater than 1 as that indicates
* a more complicated policy than this method is prepared to handle.
* Changes to such policies must be made manually by the setBindings()
* method.
*
*
* Example:
* ```
* $builder->addBinding('roles/admin', [ 'user:admin@domain.com' ]);
* ```
*
* @param string $role A valid role for the service
* @param array $members An array of members to assign to the binding
* @return PolicyBuilder
* @throws \InvalidArgumentException
* @throws BadMethodCallException if the policy's version is greater than 1.
* @deprecated
*/
public function addBinding($role, array $members)
{
$this->validatePolicyVersion();
$this->bindings[] = [
'role' => $role,
'members' => $members
];
return $this;
}
/**
* Remove a binding from the policy.
*
* This method will fail with a BadMethodCallException if it is
* called on a Policy with a version greater than 1 as that indicates
* a more complicated policy than this method is prepared to handle.
* Changes to such policies must be made manually by the setBindings()
* method.
*
* Example:
* ```
* $builder->setBindings([
* [
* 'role' => 'roles/admin',
* 'members' => [
* 'user:admin@domain.com',
* 'user2:admin@domain.com'
* ]
* ]
* ]);
* $builder->removeBinding('roles/admin', [ 'user:admin@domain.com' ]);
* ```
*
* @param string $role A valid role for the service
* @param array $members An array of members to remove from the role
* @return PolicyBuilder
* @throws \InvalidArgumentException
* @throws BadMethodCallException if the policy's version is greater than 1.
* @deprecated
*/
public function removeBinding($role, array $members)
{
$this->validatePolicyVersion();
$bindings = $this->bindings;
foreach ((array) $bindings as $i => $binding) {
if ($binding['role'] == $role) {
$newMembers = array_diff($binding['members'], $members);
if (count($newMembers) != count($binding['members']) - count($members)) {
throw new InvalidArgumentException('One or more role-members were not found.');
}
if (empty($newMembers)) {
unset($bindings[$i]);
$bindings = array_values($bindings);
} else {
$binding['members'] = array_values($newMembers);
$bindings[$i] = $binding;
}
$this->bindings = $bindings;
return $this;
}
}
throw new InvalidArgumentException('The role was not found.');
}
/**
* Update the etag on the policy.
*
* Example:
* ```
* $builder->setEtag($oldPolicy['etag']);
* ```
*
* @param string $etag used for optimistic concurrency control as a way to help prevent simultaneous updates of a
* policy from overwriting each other. It is strongly suggested that updates to existing policies make use
* of the etag to avoid race conditions.
* @return PolicyBuilder
*/
public function setEtag($etag)
{
$this->etag = $etag;
return $this;
}
/**
* Update the version of the policy.
*
* Example:
* ```
* $builder->setVersion(1);
* ```
*
* @param int $version Version of the Policy. **Defaults to** `0`.
* @return PolicyBuilder
*/
public function setVersion($version)
{
$this->version = $version;
return $this;
}
/**
* Create a policy array with data in the correct format.
*
* Example:
* ```
* $policy = $builder->result();
* ```
*
* @return array An array of policy data
*/
public function result()
{
return array_filter([
'etag' => $this->etag,
'bindings' => $this->bindings,
'version' => $this->version
]);
}
private function validatePolicyVersion()
{
if (isset($this->version) && $this->version > 1) {
throw new BadMethodCallException('Helper methods cannot be ' .
"invoked on policies with version {$this->version}.");
}
$this->validateConditions();
}
private function validateConditions()
{
if (!$this->bindings) {
return;
}
foreach ($this->bindings as $binding) {
if (isset($binding['condition'])) {
throw new BadMethodCallException('Helper methods cannot ' .
'be invoked on policies containing conditions.');
}
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/InsecureCredentialsWrapper.php
================================================
value = $value;
}
/**
* Get the value.
*
* Example:
* ```
* $value = $int64->get();
* ```
*
* @return string
*/
public function get()
{
return $this->value;
}
/**
* Provides a convenient way to access the value.
*
* @access private
*/
public function __toString()
{
return $this->value;
}
/**
* Implement JsonSerializable by returning the 64 bit integer as a string
*
* @return string
* @access private
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->value;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Iterator/ItemIterator.php
================================================
*/
class ItemIterator implements \Iterator
{
use ItemIteratorTrait;
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Iterator/ItemIteratorTrait.php
================================================
pageIterator = $pageIterator;
}
/**
* Fetch the token used to get the next set of results.
*
* @return string|null
*/
public function nextResultToken()
{
return method_exists($this->pageIterator, 'nextResultToken')
? $this->pageIterator->nextResultToken()
: null;
}
/**
* Iterate over the results on a per page basis.
*
* @return \Iterator
*/
public function iterateByPage()
{
return $this->pageIterator;
}
/**
* Rewind the iterator.
*
* @return null
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->pageIndex = 0;
$this->position = 0;
$this->pageIterator->rewind();
}
/**
* Get the current item.
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function current()
{
$page = $this->pageIterator->current();
return isset($page[$this->pageIndex])
? $page[$this->pageIndex]
: null;
}
/**
* Get the key current item's key.
*
* @return int
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
}
/**
* Advances to the next item.
*
* @return null
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->pageIndex++;
$this->position++;
if (count($this->pageIterator->current()) <= $this->pageIndex && $this->nextResultToken()) {
$this->pageIterator->next();
$this->pageIndex = 0;
}
}
/**
* Determines if the current position is valid.
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
{
$page = $this->pageIterator->current();
if (isset($page[$this->pageIndex])) {
return true;
}
// If there are no results, but a token for the next page
// exists let's continue paging until there are results.
while ($this->nextResultToken()) {
$this->pageIterator->next();
$page = $this->pageIterator->current();
if (isset($page[$this->pageIndex])) {
return true;
}
}
return false;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Iterator/PageIterator.php
================================================
resultMapper = $resultMapper;
$this->call = $call;
$this->config = $config + [
'itemsKey' => 'items',
'nextResultTokenKey' => 'nextPageToken',
'resultTokenKey' => 'pageToken',
'firstPage' => null,
'resultLimit' => 0,
'setNextResultTokenCondition' => function () {
return true;
}
];
$this->callOptions = $callOptions;
$this->resultTokenPath = explode('.', $this->config['resultTokenKey']);
$this->nextResultTokenPath = explode('.', $this->config['nextResultTokenKey']);
$this->itemsPath = explode('.', $this->config['itemsKey']);
$this->initialResultToken = $this->nextResultToken();
}
/**
* Fetch the token used to get the next set of results.
*
* @return string|null
*/
public function nextResultToken()
{
return $this->get($this->resultTokenPath, $this->callOptions);
}
/**
* Rewind the iterator.
*
* @return null
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->itemCount = 0;
$this->position = 0;
if ($this->config['firstPage']) {
list($this->page, $shouldContinue) = $this->mapResults($this->config['firstPage']);
$nextResultToken = $this->determineNextResultToken($this->page, $shouldContinue);
} else {
$this->page = null;
$nextResultToken = $this->initialResultToken;
}
if ($nextResultToken) {
$this->set($this->resultTokenPath, $this->callOptions, $nextResultToken);
}
}
/**
* Get the current page.
*
* @return array|null
*/
#[\ReturnTypeWillChange]
public function current()
{
if ($this->page === null) {
$this->page = $this->executeCall();
}
$page = $this->get($this->itemsPath, $this->page);
if ($this->nextResultToken()) {
return $page ?: [];
}
return $page;
}
/**
* Get the key current page's key.
*
* @return int
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
}
/**
* Advances to the next page.
*
* @return null
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->position++;
$this->page = $this->nextResultToken()
? $this->executeCall()
: null;
}
/**
* Determines if the current position is valid.
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
{
if (!$this->page && $this->position) {
return false;
}
return true;
}
/**
* Executes the provided call to get a set of results.
*
* @return array
*/
private function executeCall()
{
$call = $this->call;
list($results, $shouldContinue) = $this->mapResults(
$call($this->callOptions)
);
$this->set(
$this->resultTokenPath,
$this->callOptions,
$this->determineNextResultToken($results, $shouldContinue)
);
return $results;
}
/**
* @param array $results
* @return array
*/
private function mapResults(array $results)
{
$items = $this->get($this->itemsPath, $results);
$resultMapper = $this->resultMapper;
$shouldContinue = true;
if ($items) {
foreach ($items as $key => $item) {
$items[$key] = $resultMapper($item);
$this->itemCount++;
if ($this->config['resultLimit'] && $this->config['resultLimit'] <= $this->itemCount) {
$items = array_slice($items, 0, $key + 1);
$shouldContinue = false;
break;
}
}
$this->set($this->itemsPath, $results, $items);
}
return [$results, $shouldContinue];
}
/**
* @param array $results
* @param bool $shouldContinue
* @return null
*/
private function determineNextResultToken(array $results, $shouldContinue = true)
{
return $shouldContinue && $this->config['setNextResultTokenCondition']($results)
? $this->get($this->nextResultTokenPath, $results)
: null;
}
/**
* @param array $path
* @param array $array
* @return mixed
*/
private function get(array $path, array $array)
{
$result = $array;
foreach ($path as $key) {
if (!isset($result[$key])) {
return null;
}
$result = $result[$key];
}
return $result;
}
/**
* @param array $path
* @param array $array
* @param mixed $value
* @return null
*/
private function set(array $path, array &$array, $value)
{
$temp = &$array;
foreach ($path as $key) {
$temp = &$temp[$key];
}
$temp = $value;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/JsonTrait.php
================================================
true
];
$this->exclusive = $options['exclusive'];
$this->filePath = sprintf(
self::FILE_PATH_TEMPLATE,
sys_get_temp_dir(),
$fileName
);
}
/**
* Acquires a lock that will block until released.
*
* @param array $options [optional] {
* Configuration options.
*
* @type bool $blocking Whether the process should block while waiting
* to acquire the lock. **Defaults to** true.
* }
* @return bool
* @throws \RuntimeException If the lock fails to be acquired.
*/
public function acquire(array $options = [])
{
if ($this->handle) {
return true;
}
$this->handle = $this->initializeHandle();
if (!flock($this->handle, $this->lockType($options))) {
fclose($this->handle);
$this->handle = null;
throw new \RuntimeException('Failed to acquire lock.');
}
return true;
}
/**
* Releases the lock.
*
* @throws \RuntimeException If the lock fails to release.
*/
public function release()
{
if ($this->handle) {
$released = flock($this->handle, LOCK_UN);
fclose($this->handle);
$this->handle = null;
if (!$released) {
throw new \RuntimeException('Failed to release lock.');
}
}
}
/**
* Initializes the handle.
*
* @return resource
* @throws \RuntimeException If the lock file fails to open.
*/
private function initializeHandle()
{
$handle = @fopen($this->filePath, 'c');
if (!$handle) {
throw new \RuntimeException('Failed to open lock file.');
}
return $handle;
}
private function lockType(array $options)
{
$options += [
'blocking' => true
];
$lockType = $this->exclusive ? LOCK_EX : LOCK_SH;
if (!$options['blocking']) {
$lockType |= LOCK_UN;
}
return $lockType;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Lock/LockInterface.php
================================================
acquire($options)) {
try {
$result = $func();
} catch (\Exception $ex) {
$exception = $ex;
}
$this->release();
}
if ($exception) {
throw $exception;
}
return $result;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Lock/SemaphoreLock.php
================================================
isSysvIPCLoaded()) {
throw new \RuntimeException('SystemV IPC extensions are required.');
}
if (!is_int($key)) {
throw new \InvalidArgumentException('The provided key must be an integer.');
}
$this->key = $key;
}
/**
* Acquires a lock that will block until released.
*
* @param array $options [optional] {
* Configuration options.
*
* @type bool $blocking Whether the process should block while waiting
* to acquire the lock. **Defaults to** true.
* }
* @return bool
* @throws \RuntimeException If the lock fails to be acquired.
*/
public function acquire(array $options = [])
{
$options += [
'blocking' => true
];
if ($this->semaphoreId) {
return true;
}
$this->semaphoreId = $this->initializeId();
if (!sem_acquire($this->semaphoreId, !$options['blocking'])) {
$this->semaphoreId = null;
throw new \RuntimeException('Failed to acquire lock.');
}
return true;
}
/**
* Releases the lock.
*
* @throws \RuntimeException If the lock fails to release.
*/
public function release()
{
if ($this->semaphoreId) {
$released = sem_release($this->semaphoreId);
$this->semaphoreId = null;
if (!$released) {
throw new \RuntimeException('Failed to release lock.');
}
}
}
/**
* Initializes the semaphore ID.
*
* @return resource
* @throws \RuntimeException If semaphore ID fails to generate.
*/
private function initializeId()
{
$semaphoreId = sem_get($this->key);
if (!$semaphoreId) {
throw new \RuntimeException('Failed to generate semaphore ID.');
}
return $semaphoreId;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Lock/SymfonyLockAdapter.php
================================================
lock = $lock;
}
/**
* Acquires a lock that will block until released.
*
* @param array $options [optional] {
* Configuration options.
*
* @type bool $blocking Whether the process should block while waiting
* to acquire the lock. **Defaults to** true.
* }
* @return bool
* @throws \RuntimeException If the lock fails to be acquired.
*/
public function acquire(array $options = [])
{
$options += [
'blocking' => true
];
try {
return $this->lock->acquire($options['blocking']);
} catch (\Exception $ex) {
throw new \RuntimeException(
sprintf(
'Acquiring the lock failed with the following message: %s',
$ex->getMessage()
),
0,
$ex
);
}
}
/**
* Releases the lock.
*
* @throws \RuntimeException
*/
public function release()
{
try {
$this->lock->release();
} catch (\Exception $ex) {
throw new \RuntimeException(
sprintf(
'Releasing the lock failed with the following message: %s',
$ex->getMessage()
),
0,
$ex
);
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Logger/AppEngineFlexFormatter.php
================================================
formatPayload($record, parent::format($record));
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Logger/AppEngineFlexFormatterV2.php
================================================
formatPayload($record, parent::format($record));
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Logger/AppEngineFlexFormatterV3.php
================================================
formatPayload($record, parent::format($record));
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Logger/AppEngineFlexHandler.php
================================================
toArray();
}
list($usec, $sec) = explode(' ', microtime());
$usec = (int) (((float) $usec) * 1000000000);
$sec = (int) $sec;
$payload = [
'message' => $message,
'timestamp' => ['seconds' => $sec, 'nanos' => $usec],
'thread' => '',
'severity' => $record['level_name'],
];
if (isset($_SERVER['HTTP_X_CLOUD_TRACE_CONTEXT'])) {
$payload['traceId'] = explode(
'/',
$_SERVER['HTTP_X_CLOUD_TRACE_CONTEXT']
)[0];
}
return "\n" . json_encode($payload);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/LongRunning/LROTrait.php
================================================
lroConnection = $lroConnection;
$this->lroCallables = $lroCallables;
$this->lroResource = $resource;
}
/**
* Resume a Long Running Operation
*
* @param string $operationName The Long Running Operation name.
* @param array $info [optional] The operation data.
* @return LongRunningOperation
*/
public function resumeOperation($operationName, array $info = [])
{
return new LongRunningOperation(
$this->lroConnection,
$operationName,
$this->lroCallables,
$info
);
}
/**
* List long running operations.
*
* @param array $options [optional] {
* Configuration Options.
*
* @type string $name The name of the operation collection.
* @type string $filter The standard list filter.
* @type int $pageSize Maximum number of results to return per
* request.
* @type int $resultLimit Limit the number of results returned in total.
* **Defaults to** `0` (return all results).
* @type string $pageToken A previously-returned page token used to
* resume the loading of results from a specific point.
* }
* @return ItemIterator
*/
public function longRunningOperations(array $options = [])
{
if (is_null($this->lroResource)) {
throw new \BadMethodCallException('This service does list support listing operations.');
}
$resultLimit = $this->pluck('resultLimit', $options, false) ?: 0;
$options['name'] = $this->lroResource . '/operations';
return new ItemIterator(
new PageIterator(
function (array $operation) {
return $this->resumeOperation($operation['name'], $operation);
},
[$this->lroConnection, 'operations'],
$options,
[
'itemsKey' => 'operations',
'resultLimit' => $resultLimit
]
)
);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/LongRunning/LongRunningClientConnection.php
================================================
gapicClient->resumeOperation($args['name']);
return $this->operationResponseToArray($operationResponse);
}
/**
* @param array $args
* @return array
*/
public function cancel(array $args): array
{
$operationResponse = $this->gapicClient->resumeOperation(
$args['name'],
$args['method'] ?? null
);
$operationResponse->cancel();
return $this->operationResponseToArray($operationResponse);
}
/**
* @param array $args
* @return array
*/
public function delete(array $args): array
{
$operationResponse = $this->gapicClient->resumeOperation(
$args['name'],
$args['method'] ?? null
);
$operationResponse->cancel();
return $this->operationResponseToArray($operationResponse);
}
/**
* @param array $args
* @return array
*/
public function operations(array $args): array
{
$request = ListOperationsRequest::build($args['name'], $args['filter'] ?? null);
$response = $this->gapicClient->getOperationsClient()->listOperations($request);
return $this->handleResponse($response);
}
private function operationResponseToArray(OperationResponse $operationResponse): array
{
$response = $this->handleResponse($operationResponse->getLastProtoResponse());
$metaType = $response['metadata']['typeUrl'];
// unpack result Any type
$result = $operationResponse->getResult();
if ($result instanceof Any) {
// For some reason we aren't doing this in GAX OperationResponse (but we should)
$result = $result->unpack();
}
$response['response'] = $this->handleResponse($result);
// unpack error Any type
$response['error'] = $this->handleResponse($operationResponse->getError());
$metadata = $operationResponse->getMetadata();
if ($metadata instanceof Any) {
// For some reason we aren't doing this in GAX OperationResponse (but we should)
$metadata = $metadata->unpack();
}
$response['metadata'] = $this->handleResponse($metadata);
// Used in LongRunningOperation to invoke callables
$response['metadata'] += ['typeUrl' => $metaType];
return $response;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/LongRunning/LongRunningConnectionInterface.php
================================================
connection = $connection;
$this->name = $name;
$this->callablesMap = $callablesMap;
$this->info = $info;
}
/**
* Return the Operation name.
*
* Example:
* ```
* $name = $operation->name();
* ```
*
* @return string
*/
public function name()
{
return $this->name;
}
/**
* Check if the Operation is done.
*
* If the Operation state is not available, a service request may be executed
* by this method.
*
* Example:
* ```
* if ($operation->done()) {
* echo "The operation is done!";
* }
* ```
*
* @param array $options [optional] Configuration options.
* @return bool
*/
public function done(array $options = [])
{
return (isset($this->info($options)['done']))
? $this->info['done']
: false;
}
/**
* Get the state of the Operation.
*
* Return value will be one of `LongRunningOperation::STATE_IN_PROGRESS`,
* `LongRunningOperation::STATE_SUCCESS` or
* `LongRunningOperation::STATE_ERROR`.
*
* If the Operation state is not available, a service request may be executed
* by this method.
*
* Example:
* ```
* switch ($operation->state()) {
* case LongRunningOperation::STATE_IN_PROGRESS:
* echo "Operation is in progress";
* break;
*
* case LongRunningOperation::STATE_SUCCESS:
* echo "Operation succeeded";
* break;
*
* case LongRunningOperation::STATE_ERROR:
* echo "Operation failed";
* break;
* }
* ```
*
* @param array $options [optional] Configuration options.
* @return string
*/
public function state(array $options = [])
{
if (!$this->done($options)) {
return self::STATE_IN_PROGRESS;
}
if ($this->done() && $this->result()) {
return self::STATE_SUCCESS;
}
return self::STATE_ERROR;
}
/**
* Get the Operation result.
*
* The return type of this method is dictated by the type of Operation.
*
* Returns null if the Operation is not yet complete, or if an error occurred.
*
* If the Operation state is not available, a service request may be executed
* by this method.
*
* Example:
* ```
* $result = $operation->result();
* ```
*
* @param array $options [optional] Configuration options.
* @return T|mixed|null
*/
public function result(array $options = [])
{
$this->info($options);
return $this->result;
}
/**
* Get the Operation error.
*
* Returns null if the Operation is not yet complete, or if no error occurred.
*
* If the Operation state is not available, a service request may be executed
* by this method.
*
* Example:
* ```
* $error = $operation->error();
* ```
*
* @param array $options [optional] Configuration options.
* @return array|null
*/
public function error(array $options = [])
{
$this->info($options);
return $this->error;
}
/**
* Get the Operation info.
*
* If the Operation state is not available, a service request may be executed
* by this method.
*
* Example:
* ```
* $info = $operation->info();
* ```
*
* @codingStandardsIgnoreStart
* @param array $options [optional] Configuration options.
* @return array [google.longrunning.Operation](https://cloud.google.com/spanner/docs/reference/rpc/google.longrunning#google.longrunning.Operation)
* @codingStandardsIgnoreEnd
*/
public function info(array $options = [])
{
return $this->info ?: $this->reload($options);
}
/**
* Reload the Operation to check its status.
*
* Example:
* ```
* $result = $operation->reload();
* ```
*
* @codingStandardsIgnoreStart
* @param array $options [optional] Configuration Options.
* @return array [google.longrunning.Operation](https://cloud.google.com/spanner/docs/reference/rpc/google.longrunning#google.longrunning.Operation)
* @codingStandardsIgnoreEnd
*/
public function reload(array $options = [])
{
$res = $this->connection->get([
'name' => $this->name,
] + $options);
$this->result = null;
$this->error = null;
if ($res['done'] ?? false && isset($res['metadata']['typeUrl'])) {
$type = $res['metadata']['typeUrl'];
$this->result = $this->executeDoneCallback($type, $res['response']);
$this->error = $res['error'] ?? null;
}
return $this->info = $res;
}
/**
* Reload the operation until it is complete.
*
* The return type of this method is dictated by the type of Operation. If
* `$options.maxPollingDurationSeconds` is set, and the poll exceeds the
* limit, the return will be `null`.
*
* Example:
* ```
* $result = $operation->pollUntilComplete();
* ```
*
* @param array $options {
* Configuration Options
*
* @type float $pollingIntervalSeconds The polling interval to use, in
* seconds. **Defaults to** `1.0`.
* @type float $maxPollingDurationSeconds The maximum amount of time to
* continue polling. **Defaults to** `0.0`.
* }
* @return mixed|null
*/
public function pollUntilComplete(array $options = [])
{
$options += [
'pollingIntervalSeconds' => $this::WAIT_INTERVAL,
'maxPollingDurationSeconds' => 0.0,
];
$pollingIntervalMicros = $options['pollingIntervalSeconds'] * 1000000;
$maxPollingDuration = $options['maxPollingDurationSeconds'];
$hasMaxPollingDuration = $maxPollingDuration > 0.0;
$endTime = microtime(true) + $maxPollingDuration;
do {
usleep($pollingIntervalMicros);
$this->reload($options);
} while (!$this->done() && (!$hasMaxPollingDuration || microtime(true) < $endTime));
return $this->result;
}
/**
* Cancel a Long Running Operation.
*
* Example:
* ```
* $operation->cancel();
* ```
*
* @param array $options Configuration options.
* @return void
*/
public function cancel(array $options = [])
{
$this->connection->cancel([
'name' => $this->name
]);
}
/**
* Delete a Long Running Operation.
*
* Example:
* ```
* $operation->delete();
* ```
*
* @param array $options Configuration Options.
* @return void
*/
public function delete(array $options = [])
{
$this->connection->delete([
'name' => $this->name
]);
}
/**
* When the Operation is complete, there may be a callback enqueued to
* handle the response. If so, execute it and return the result.
*
* @param string $type The response type.
* @param mixed $response The response data.
* @return mixed
*/
private function executeDoneCallback($type, $response)
{
if (is_null($response)) {
return null;
}
$callables = array_filter($this->callablesMap, function ($callable) use ($type) {
return $callable['typeUrl'] === $type;
});
if (count($callables) === 0) {
return $response;
}
$callable = current($callables);
$fn = $callable['callable'];
return call_user_func($fn, $response);
}
/**
* @access private
*/
public function __debugInfo()
{
return [
'connection' => get_class($this->connection),
'name' => $this->name,
'callablesMap' => array_keys($this->callablesMap),
'info' => $this->info
];
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/LongRunning/OperationResponseTrait.php
================================================
getLastProtoResponse();
if (is_null($response)) {
return null;
}
$response = $serializer->encodeMessage($response);
$result = null;
if ($operation->isDone() && isset($response['response']['typeUrl'])) {
$type = $response['response']['typeUrl'];
$result = $this->deserializeResult($operation, $type, $serializer, $lroMappers);
}
$metaType = $response['metadata']['typeUrl'];
$metaResult = $this->deserializeMetadata($operation, $metaType, $serializer, $lroMappers);
/** @see LongRunningOperation#reload() */
$metaResult += ['typeUrl' => $metaType];
$error = $operation->getError();
if (!is_null($error)) {
$error = $serializer->encodeMessage($error);
}
$response['response'] = $result;
$response['metadata'] = $metaResult;
$response['error'] = $error;
return $response;
}
/**
* Fetch an OperationResponse object from a gapic client.
*
* @param mixed $client A generated client with a `resumeOperation` method.
* @param string $name The Operation name.
* @param string|null $method The method name.
* @return OperationResponse
*/
private function getOperationByName($client, $name, $method = null)
{
return $client->resumeOperation($name, $method);
}
/**
* Convert an operation response to an array
*
* @param OperationResponse|GaxOperationResponse $operation The operation to
* serialize.
* @param string $type The Operation type. The type should correspond to a
* member of $mappers.typeUrl.
* @param Serializer|GaxSerializer $serializer The gRPC serializer to use
* for the deserialization.
* @param array $mappers A list of mappers.
* @return array|null
*/
private function deserializeResult($operation, $type, $serializer, array $mappers)
{
$mappers = array_filter($mappers, function ($mapper) use ($type) {
return $mapper['typeUrl'] === $type;
});
if (count($mappers) === 0) {
throw new \RuntimeException(sprintf('No mapper exists for operation response type %s.', $type));
}
$mapper = current($mappers);
$message = $mapper['message'];
$response = new $message();
$anyResponse = $operation->getLastProtoResponse()->getResponse();
if (is_null($anyResponse)) {
return null;
}
$response->mergeFromString($anyResponse->getValue());
return $serializer->encodeMessage($response);
}
/**
* Convert an operation metadata to an array
*
* @param OperationResponse|GaxOperationResponse $operation The operation to
* serialize.
* @param string $type The Operation type. The type should correspond to a
* member of $mappers.typeUrl.
* @param Serializer|GaxSerializer $serializer The gRPC serializer to use
* for the deserialization.
* @param array $mappers A list of mappers.
* @return array|null
*/
private function deserializeMetadata($operation, $type, $serializer, array $mappers)
{
$mappers = array_filter($mappers, function ($mapper) use ($type) {
return $mapper['typeUrl'] === $type;
});
if (count($mappers) === 0) {
throw new \RuntimeException(sprintf('No mapper exists for operation metadata type %s.', $type));
}
$mapper = current($mappers);
$message = $mapper['message'];
$response = new $message();
$anyResponse = $operation->getLastProtoResponse()->getMetadata();
if (is_null($anyResponse)) {
return null;
}
$response->mergeFromString($anyResponse->getValue());
return $serializer->encodeMessage($response);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/OptionsValidator.php
================================================
vaidateOptions(
* $options,
* ['customOp1', 'customOp2'],
* new CommitRequest(),
* CallOptions::class,
* );
* ```
*
* @param array $options
* @param array|Message|string ...$optionTypes
* @return array
* @throws LogicException when a value exists which is not supported by any of the `$optionTypes`.
*/
public function validateOptions(array $options, array|Message|string ...$optionTypes): array
{
$splitOptions = [];
foreach ($optionTypes as $optionType) {
if (is_array($optionType)) {
$splitOptions[] = $this->pluckArray($optionType, $options);
} elseif ($optionType === CallOptions::class) {
$callOptionKeys = array_keys((new CallOptions([]))->toArray());
$splitOptions[] = $this->pluckArray($callOptionKeys, $options);
} elseif ($optionType instanceof Message) {
$messageKeys = array_map(
fn ($method) => lcfirst(substr($method, 3)),
array_filter(
get_class_methods($optionType),
fn ($m) => 0 === strpos($m, 'get')
)
);
$messageOptions = $this->pluckArray($messageKeys, $options);
if ($this->serializer) {
$optionType = $this->serializer->decodeMessage($optionType, $messageOptions);
} else {
$optionType->mergeFromJsonString(json_encode($messageOptions, JSON_FORCE_OBJECT));
}
$splitOptions[] = $optionType;
} elseif (is_string($optionType)) {
$splitOptions[] = $this->pluck($optionType, $options, false);
} else {
throw new LogicException(sprintf('Invalid option type: %s', $optionType));
}
}
if (!empty($options)) {
throw new LogicException(
'Unexpected option(s) provided: ' . implode(', ', array_keys($options))
);
}
return $splitOptions;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/PhpArray.php
================================================
customFilters = $customFilters;
$this->useCamelCase = $useCamelCase;
}
/**
* Borrowed heavily from {@see DrSlump\Protobuf\Codec\PhpArray::encodeMessage()}.
* With this approach we are able to transform the response with minimal
* overhead.
*/
protected function encodeMessage(Protobuf\Message $message)
{
$descriptor = Protobuf::getRegistry()->getDescriptor($message);
$data = [];
foreach ($descriptor->getFields() as $tag => $field) {
$empty = !$message->_has($tag);
if ($field->isRequired() && $empty) {
throw new \UnexpectedValueException(
sprintf(
'Message %s\'s field tag %s(%s) is required but has no value',
get_class($message),
$tag,
$field->getName()
)
);
}
if ($empty) {
continue;
}
$key = $this->useTagNumber ? $field->getNumber() : $field->getName();
$v = $message->_get($tag);
if ($field->isRepeated()) {
// Make sure the value is an array of values
$v = is_array($v) ? $v : [$v];
$arr = [];
foreach ($v as $k => $vv) {
// Skip nullified repeated values
if (null === $vv) {
continue;
}
$filteredValue = $this->filterValue($vv, $field);
if ($this->isKeyValueMessage($vv)) {
$arr[key($filteredValue)] = current($filteredValue);
} else {
$arr[$k] = $filteredValue;
}
$v = $arr;
}
} else {
$v = $this->filterValue($v, $field);
}
$key = ($this->useCamelCase) ? $this->toCamelCase($key) : $key;
if (isset($this->customFilters[$key])) {
$v = call_user_func($this->customFilters[$key], $v);
}
$data[$key] = $v;
}
return $data;
}
/**
* Borrowed heavily from {@see DrSlump\Protobuf\Codec\PhpArray::decodeMessage()}.
* The only addition here is converting camel case field names to snake case.
*/
protected function decodeMessage(Protobuf\Message $message, $data)
{
// Get message descriptor
$descriptor = Protobuf::getRegistry()->getDescriptor($message);
foreach ($data as $key => $v) {
// Get the field by tag number or name
$field = $this->useTagNumber
? $descriptor->getField($key)
: $descriptor->getFieldByName($this->toSnakeCase($key));
// Unknown field found
if (!$field) {
$unknown = new Protobuf\Codec\PhpArray\Unknown($key, gettype($v), $v);
$message->addUnknown($unknown);
continue;
}
if ($field->isRepeated()) {
// Make sure the value is an array of values
$v = is_array($v) && is_int(key($v)) ? $v : [$v];
foreach ($v as $k => $vv) {
$v[$k] = $this->filterValue($vv, $field);
}
} else {
$v = $this->filterValue($v, $field);
}
$message->_set($field->getNumber(), $v);
}
return $message;
}
protected function filterValue($value, Protobuf\Field $field)
{
if (trim($field->getReference(), '\\') === NullValue::class) {
return null;
}
if ($value instanceof Protobuf\Message) {
if ($this->isKeyValueMessage($value)) {
$v = $value->getValue();
return [
$value->getKey() => $v instanceof Protobuf\Message
? $this->encodeMessage($v)
: $v
];
}
if ($value instanceof Struct) {
$vals = [];
foreach ($value->getFields() as $field) {
$val = $this->filterValue(
$field->getValue(),
$field->descriptor()->getFieldByName('value')
);
$vals[$field->getKey()] = $val;
}
return $vals;
}
if ($value instanceof ListValue) {
$vals = [];
foreach ($value->getValuesList() as $val) {
$fields = $val->descriptor()->getFields();
foreach ($fields as $field) {
$name = $field->getName();
if ($val->$name !== null) {
$vals[] = $this->filterValue($val->$name, $field);
}
}
}
return $vals;
}
if ($value instanceof Value) {
$fields = $value->descriptor()->getFields();
foreach ($fields as $field) {
$name = $field->getName();
if ($value->$name !== null) {
return $this->filterValue($value->$name, $field);
}
}
}
}
return parent::filterValue($value, $field);
}
private function toSnakeCase($key)
{
return strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $key));
}
private function toCamelCase($key)
{
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $key))));
}
private function isKeyValueMessage($value)
{
return property_exists($value, 'key') && property_exists($value, 'value');
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Report/CloudRunJobMetadataProvider.php
================================================
serviceId = $env['CLOUD_RUN_JOB'] ?? 'unknown-job';
$this->revisionId = $env['CLOUD_RUN_EXECUTION'] ?? '';
$this->taskIndex = $env['CLOUD_RUN_TASK_INDEX'] ?? '';
$this->taskAttempt = $env['CLOUD_RUN_TASK_ATTEMPT'] ?? '';
$this->traceId = isset($env['HTTP_X_CLOUD_TRACE_CONTEXT'])
? \substr($env['HTTP_X_CLOUD_TRACE_CONTEXT'], 0, 32)
: null;
$this->metadata = $metadata ?? new Metadata();
$this->region = \basename($this->metadata->get('instance/region') ?? '');
$this->instanceId = $this->metadata->get('instance/id');
}
/**
* @return array
*/
public function monitoredResource()
{
return [
'type' => 'cloud_run_job',
'labels' => [
'job_name' => $this->serviceId,
'location' => $this->region,
'project_id' => $this->projectId(),
],
];
}
/**
* Return the project id.
* @return string
*/
public function projectId()
{
return $this->metadata->getProjectId();
}
/**
* Return the service id.
* @return string
*/
public function serviceId()
{
return $this->serviceId;
}
/**
* Return the version id.
* @return string
*/
public function versionId()
{
return $this->revisionId;
}
/**
* Return the labels.
* @return array
*/
public function labels()
{
$labels = [
'instanceId' => $this->instanceId,
'run.googleapis.com/execution_name' => $this->revisionId,
'run.googleapis.com/task_attempt' => $this->taskAttempt,
'run.googleapis.com/task_index' => $this->taskIndex,
'run.googleapis.com/trace_id' => $this->traceId,
];
return \array_filter($labels);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Report/CloudRunMetadataProvider.php
================================================
configurationId = $env['K_CONFIGURATION'] ?? 'unknown-configuration';
$this->serviceId = $env['K_SERVICE'] ?? 'unknown-service';
$this->revisionId = $env['K_REVISION'] ?? 'unknown-revision';
$this->traceId = isset($env['HTTP_X_CLOUD_TRACE_CONTEXT'])
? \substr($env['HTTP_X_CLOUD_TRACE_CONTEXT'], 0, 32)
: null;
$this->metadata = $metadata ?? new Metadata();
$this->region = \basename($this->metadata->get('instance/region') ?? '');
$this->instanceId = $this->metadata->get('instance/id');
}
/**
* @return array
*/
public function monitoredResource()
{
return [
'type' => 'cloud_run_revision',
'labels' => [
'configuration_name' => $this->configurationId,
'location' => $this->region,
'project_id' => $this->projectId(),
'revision_name' => $this->revisionId,
'service_name' => $this->serviceId,
],
];
}
/**
* Return the project id.
* @return string
*/
public function projectId()
{
return $this->metadata->getProjectId();
}
/**
* Return the service id.
* @return string
*/
public function serviceId()
{
return $this->serviceId;
}
/**
* Return the version id.
* @return string
*/
public function versionId()
{
return $this->revisionId;
}
/**
* Return the labels. We need to evaluate $_SERVER for each request.
*
* @return array
* @todo Figure out where to get the `container_name` from
*/
public function labels()
{
$labels = [
'instanceId' => $this->instanceId,
'run.googleapis.com/trace_id' => $this->traceId,
];
return \array_filter($labels);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Report/EmptyMetadataProvider.php
================================================
$this->getTraceValue($server)]
: [];
$this->data =
[
'resource' => [
'type' => 'gae_app',
'labels' => [
'project_id' => $projectId,
'version_id' => $versionId,
'module_id' => $serviceId
]
],
'projectId' => $projectId,
'serviceId' => $serviceId,
'versionId' => $versionId,
'labels' => $labels
];
}
/**
* Return an array representing MonitoredResource.
*
* @see https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource
*
* @return array
*/
public function monitoredResource()
{
return $this->data['resource'];
}
/**
* Return the project id.
* @return string
*/
public function projectId()
{
return $this->data['projectId'];
}
/**
* Return the service id.
* @return string
*/
public function serviceId()
{
return $this->data['serviceId'];
}
/**
* Return the version id.
* @return string
*/
public function versionId()
{
return $this->data['versionId'];
}
/**
* Return the labels. We need to evaluate $_SERVER for each request.
* @return array
*/
public function labels()
{
return $this->data['labels'];
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Report/GAEStandardMetadataProvider.php
================================================
data['monitoredResource'] = $monitoredResource;
$this->data['projectId'] = $projectId;
$this->data['serviceId'] = $serviceId;
$this->data['versionId'] = $versionId;
$this->data['labels'] = $labels;
}
/**
* Return an array representing MonitoredResource.
*
* @see https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource
*
* @return array
*/
public function monitoredResource()
{
return $this->data['monitoredResource'];
}
/**
* Return the project id.
* @return string
*/
public function projectId()
{
return $this->data['projectId'];
}
/**
* Return the service id.
* @return string
*/
public function serviceId()
{
return $this->data['serviceId'];
}
/**
* Return the version id.
* @return string
*/
public function versionId()
{
return $this->data['versionId'];
}
/**
* Return the labels.
* @return array
*/
public function labels()
{
return $this->data['labels'];
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/RequestBuilder.php
================================================
service = $this->loadServiceDefinition($servicePath);
$this->resourceRoot = $resourceRoot;
// Append service definition base path if bare apiEndpoint domain is given.
if (isset($this->service['basePath'])) {
$uriParts = parse_url($baseUri) + ['path' => null];
if (!$uriParts['path'] || $uriParts['path'] === '/') {
$uriParts['path'] = $this->service['basePath'];
// Recreate the URI from its modified parts and ensure it ends in a single slash.
$this->baseUri = rtrim((string) Uri::fromParts($uriParts), '/') . '/';
return;
}
}
$this->baseUri = rtrim($baseUri, '/') . '/';
}
/**
* Build the request.
*
* @param string $resource
* @param string $method
* @param array $options [optional]
* @return RequestInterface
* @todo complexity high, revisit
* @todo consider validating against the schemas
*/
public function build($resource, $method, array $options = [])
{
$root = $this->resourceRoot;
array_push($root, 'resources');
$root = array_merge($root, explode('.', $resource));
array_push($root, 'methods', $method);
$action = $this->service;
foreach ($root as $rootItem) {
if (!isset($action[$rootItem])) {
throw new \InvalidArgumentException('Provided path item ' . $rootItem . ' does not exist.');
}
$action = $action[$rootItem];
}
$path = [];
$query = [];
$body = [];
if (isset($action['parameters'])) {
foreach ($action['parameters'] as $parameter => $parameterOptions) {
if ($parameterOptions['location'] === 'path' && array_key_exists($parameter, $options)) {
$path[$parameter] = $options[$parameter];
unset($options[$parameter]);
}
if ($parameterOptions['location'] === 'query') {
// flatten nested querystring parameters into dot-syntax
if (false !== strpos($parameter, '.')) {
list($object, $property) = explode('.', $parameter, 2);
if (isset($options[$object][$property])) {
$options[$parameter] = $options[$object][$property];
}
}
if (array_key_exists($parameter, $options)) {
$query[$parameter] = $options[$parameter];
}
}
}
}
if (isset($this->service['parameters'])) {
foreach ($this->service['parameters'] as $parameter => $parameterOptions) {
if ($parameterOptions['location'] === 'query' && array_key_exists($parameter, $options)) {
$query[$parameter] = $options[$parameter];
}
}
}
if (isset($action['request'])) {
$schema = $action['request']['$ref'];
foreach ($this->service['schemas'][$schema]['properties'] as $property => $propertyOptions) {
if (array_key_exists($property, $options)) {
$body[$property] = $options[$property];
}
}
}
$uri = $this->buildUriWithQuery(
$this->expandUri($this->baseUri . $action['path'], $path),
$query
);
return new Request(
$action['httpMethod'],
$uri,
['Content-Type' => 'application/json'],
$body ? $this->jsonEncode($body) : null
);
}
/**
* @param string $servicePath
* @return array
*/
private function loadServiceDefinition($servicePath)
{
return $this->jsonDecode(
file_get_contents($servicePath, true),
true
);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/RequestHandler.php
================================================
$clients
* @param array $clientConfig
*/
public function __construct(
Serializer $serializer,
array $clients,
array $clientConfig = []
) {
//@codeCoverageIgnoreStart
$this->serializer = $serializer;
$clientConfig['serializer'] = $serializer;
// Adds some defaults
// gccl needs to be present for handwritten clients
$clientConfig += [
'libName' => 'gccl',
'emulatorHost' => null
];
if ((bool) $clientConfig['emulatorHost']) {
$emulatorConfig = $this->emulatorGapicConfig($clientConfig['emulatorHost']);
$clientConfig = array_merge(
$clientConfig,
$emulatorConfig
);
}
//@codeCoverageIgnoreEnd
// Initialize the client classes and store them in memory
foreach ($clients as $client) {
if (is_object($client)) {
$this->clients[get_class($client)] = $client;
} else {
$this->clients[$client] = new $client($clientConfig);
}
}
}
/**
* Helper function that forwards the request to a client obj.
*
* @param string $clientClass The request will be forwarded to this client class.
* @param string $method This method needs to be called on the client obj.
* @param Message $request The protobuf Request instance to pass as the first argument to the $method.
* @param array $optionalArgs The optional args.
* @param bool $whitelisted This decides the behaviour when a NotFoundException is encountered.
*
* @return \Generator|OperationResponse|array|null
*
* @throws ServiceException
*/
public function sendRequest(
string $clientClass,
string $method,
Message $request,
array $optionalArgs,
bool $whitelisted = false
) {
$clientObj = $this->getClientObject($clientClass);
if (!$clientObj) {
return null;
}
$allArgs = [$request];
$allArgs[] = $optionalArgs;
try {
$callable = [$clientObj, $method];
$response = call_user_func_array($callable, $allArgs);
return $this->handleResponse($response);
} catch (ApiException $ex) {
throw $this->convertToGoogleException($ex);
} catch (NotFoundException $e) {
if ($whitelisted) {
throw $this->modifyWhitelistedError($e);
}
throw $e;
}
}
/**
* Helper function that returns a client object stored in memory
* using the client class as key.
* @param $clientClass The client class whose object we need.
* @return mixed
*/
private function getClientObject(string $clientClass)
{
return $this->clients[$clientClass] ?? null;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/RequestProcessorTrait.php
================================================
RetryInfo::class,
'google.rpc.badrequest-bin' => BadRequest::class
];
/**
* Serializes a gRPC response.
*
* @param mixed $response
* @return \Generator|OperationResponse|array|null
*/
private function handleResponse($response)
{
if ($response instanceof PagedListResponse) {
$response = $response->getPage()->getResponseObject();
}
if ($response instanceof Message) {
return $this->serializer->encodeMessage($response);
}
if ($response instanceof OperationResponse) {
return $response;
}
if ($response instanceof ServerStream) {
return $this->handleStream($response);
}
return null;
}
/**
* Handles a streaming response.
*
* @param ServerStream $response
* @return \Generator|array|null
* @throws Exception\ServiceException
*/
private function handleStream(ServerStream $response)
{
try {
foreach ($response->readAll() as $count => $result) {
$res = $this->serializer->encodeMessage($result);
yield $res;
}
} catch (\Exception $ex) {
throw $this->convertToGoogleException($ex);
}
}
/**
* Convert a ApiCore exception to a Google Exception.
*
* @param \Exception $ex
* @return ServiceException
*/
private function convertToGoogleException(\Exception $ex): ServiceException
{
switch ($ex->getCode()) {
case Code::INVALID_ARGUMENT:
$exception = Exception\BadRequestException::class;
break;
case Code::NOT_FOUND:
case Code::UNIMPLEMENTED:
$exception = Exception\NotFoundException::class;
break;
case Code::ALREADY_EXISTS:
$exception = Exception\ConflictException::class;
break;
case Code::FAILED_PRECONDITION:
$exception = Exception\FailedPreconditionException::class;
break;
case Code::UNKNOWN:
$exception = Exception\ServerException::class;
break;
case Code::INTERNAL:
$exception = Exception\ServerException::class;
break;
case Code::ABORTED:
$exception = Exception\AbortedException::class;
break;
case Code::DEADLINE_EXCEEDED:
$exception = Exception\DeadlineExceededException::class;
break;
default:
$exception = Exception\ServiceException::class;
break;
}
$metadata = [];
if (method_exists($ex, 'getMetadata') && $ex->getMetadata()) {
foreach ($ex->getMetadata() as $type => $binaryValue) {
if (!isset($this->metadataTypes[$type])) {
continue;
}
$metadataElement = new $this->metadataTypes[$type]();
$metadataElement->mergeFromString($binaryValue[0]);
$metadata[] = $this->serializer->encodeMessage($metadataElement);
}
}
return new $exception($ex->getMessage(), $ex->getCode(), $ex, $metadata);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/RequestWrapper.php
================================================
`.
* @type callable $authHttpHandler A handler used to deliver PSR-7
* requests specifically for authentication. Function signature
* should match:
* `function (RequestInterface $request, array $options = []) : ResponseInterface`.
* @type callable $httpHandler A handler used to deliver PSR-7 requests.
* Function signature should match:
* `function (RequestInterface $request, array $options = []) : ResponseInterface`.
* @type array $restOptions HTTP client specific configuration options.
* @type bool $shouldSignRequest Whether to enable request signing.
* @type callable $restRetryFunction Sets the conditions for whether or
* not a request should attempt to retry. Function signature should
* match: `function (\Exception $ex) : bool`.
* @type callable $restDelayFunction Executes a delay, defaults to
* utilizing `usleep`. Function signature should match:
* `function (int $delay) : void`.
* @type callable $restCalcDelayFunction Sets the conditions for
* determining how long to wait between attempts to retry. Function
* signature should match: `function (int $attempt) : int`.
* @type string $universeDomain The expected universe of the credentials. Defaults to "googleapis.com".
* }
*/
public function __construct(array $config = [])
{
$this->setCommonDefaults($config);
$config += [
'accessToken' => null,
'asyncHttpHandler' => null,
'authHttpHandler' => null,
'httpHandler' => null,
'restOptions' => [],
'shouldSignRequest' => true,
'componentVersion' => null,
'restRetryFunction' => null,
'restDelayFunction' => null,
'restCalcDelayFunction' => null,
'universeDomain' => GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN,
];
$this->componentVersion = $config['componentVersion'];
$this->accessToken = $config['accessToken'];
$this->restOptions = $config['restOptions'];
$this->shouldSignRequest = $config['shouldSignRequest'];
$this->retryFunction = $config['restRetryFunction'] ?: $this->getRetryFunction();
$this->delayFunction = $config['restDelayFunction'] ?: function ($delay) {
usleep($delay);
};
$this->calcDelayFunction = $config['restCalcDelayFunction'];
$this->httpHandler = $config['httpHandler'] ?: HttpHandlerFactory::build();
$this->authHttpHandler = $config['authHttpHandler'] ?: $this->httpHandler;
$this->asyncHttpHandler = $config['asyncHttpHandler'] ?: $this->buildDefaultAsyncHandler();
$this->universeDomain = $config['universeDomain'];
if ($this->credentialsFetcher instanceof AnonymousCredentials) {
$this->shouldSignRequest = false;
}
}
/**
* Deliver the request.
*
* @param RequestInterface $request A PSR-7 request.
* @param array $options [optional] {
* Request options.
*
* @type float $requestTimeout Seconds to wait before timing out the
* request. **Defaults to** `0`.
* @type int $retries Number of retries for a failed request.
* **Defaults to** `3`.
* @type callable $restRetryFunction Sets the conditions for whether or
* not a request should attempt to retry. Function signature should
* match: `function (\Exception $ex) : bool`.
* @type callable $restRetryListener Runs after the restRetryFunction.
* This might be used to simply consume the exception and
* $arguments b/w retries. This returns the new $arguments thus
* allowing modification on demand for $arguments. For ex:
* changing the headers in b/w retries.
* @type callable $restDelayFunction Executes a delay, defaults to
* utilizing `usleep`. Function signature should match:
* `function (int $delay) : void`.
* @type callable $restCalcDelayFunction Sets the conditions for
* determining how long to wait between attempts to retry. Function
* signature should match: `function (int $attempt) : int`.
* @type array $restOptions HTTP client specific configuration options.
* }
* @return ResponseInterface
* @throws ServiceException
*/
public function send(RequestInterface $request, array $options = [])
{
$retryOptions = $this->getRetryOptions($options);
$backoff = new ExponentialBackoff(
$retryOptions['retries'],
$retryOptions['retryFunction'],
$retryOptions['retryListener'],
);
if ($retryOptions['delayFunction']) {
$backoff->setDelayFunction($retryOptions['delayFunction']);
}
if ($retryOptions['calcDelayFunction']) {
$backoff->setCalcDelayFunction($retryOptions['calcDelayFunction']);
}
try {
return $backoff->execute($this->httpHandler, [
$this->applyHeaders($request, $options),
$this->getRequestOptions($options)
]);
} catch (\Exception $ex) {
throw $this->convertToGoogleException($ex);
}
}
/**
* Deliver the request asynchronously.
*
* @param RequestInterface $request A PSR-7 request.
* @param array $options [optional] {
* Request options.
*
* @type float $requestTimeout Seconds to wait before timing out the
* request. **Defaults to** `0`.
* @type int $retries Number of retries for a failed request.
* **Defaults to** `3`.
* @type callable $restRetryFunction Sets the conditions for whether or
* not a request should attempt to retry. Function signature should
* match: `function (\Exception $ex, int $retryAttempt) : bool`.
* @type callable $restDelayFunction Executes a delay, defaults to
* utilizing `usleep`. Function signature should match:
* `function (int $delay) : void`.
* @type callable $restCalcDelayFunction Sets the conditions for
* determining how long to wait between attempts to retry. Function
* signature should match: `function (int $attempt) : int`.
* @type array $restOptions HTTP client specific configuration options.
* }
* @return PromiseInterface
* @throws ServiceException
* @experimental The experimental flag means that while we believe this method
* or class is ready for use, it may change before release in backwards-
* incompatible ways. Please use with caution, and test thoroughly when
* upgrading.
*/
public function sendAsync(RequestInterface $request, array $options = [])
{
// Unfortunately, the current ExponentialBackoff implementation doesn't
// play nicely with promises.
$retryAttempt = 0;
$fn = function ($retryAttempt) use (&$fn, $request, $options) {
$asyncHttpHandler = $this->asyncHttpHandler;
$retryOptions = $this->getRetryOptions($options);
if (!$retryOptions['calcDelayFunction']) {
$retryOptions['calcDelayFunction'] = [ExponentialBackoff::class, 'calculateDelay'];
}
return $asyncHttpHandler(
$this->applyHeaders($request, $options),
$this->getRequestOptions($options)
)->then(null, function (\Exception $ex) use ($fn, $retryAttempt, $retryOptions) {
$shouldRetry = $retryOptions['retryFunction']($ex, $retryAttempt);
if ($shouldRetry === false || $retryAttempt >= $retryOptions['retries']) {
throw $this->convertToGoogleException($ex);
}
$delay = $retryOptions['calcDelayFunction']($retryAttempt);
$retryOptions['delayFunction']($delay);
$retryAttempt++;
return $fn($retryAttempt);
});
};
return $fn($retryAttempt);
}
/**
* Applies headers to the request.
*
* @param RequestInterface $request A PSR-7 request.
* @param array $options
* @return RequestInterface
*/
private function applyHeaders(RequestInterface $request, array $options = [])
{
$headers = [
'User-Agent' => 'gcloud-php/' . $this->componentVersion,
Retry::RETRY_HEADER_KEY => sprintf(
'gl-php/%s gccl/%s',
PHP_VERSION,
$this->componentVersion
),
];
if (isset($options['retryHeaders'])) {
$headers[Retry::RETRY_HEADER_KEY] = sprintf(
'%s %s',
$headers[Retry::RETRY_HEADER_KEY],
implode(' ', $options['retryHeaders'])
);
unset($options['retryHeaders']);
}
$request = Utils::modifyRequest($request, ['set_headers' => $headers]);
if ($this->shouldSignRequest) {
$quotaProject = $this->quotaProject;
if ($this->accessToken) {
// if an access token is provided, check the universe domain against "googleapis.com"
$this->checkUniverseDomain(null);
$request = $request->withHeader('authorization', 'Bearer ' . $this->accessToken);
} else {
// if a credentials fetcher is provided, check the universe domain against the
// credential's universe domain
$credentialsFetcher = $this->getCredentialsFetcher();
$this->checkUniverseDomain($credentialsFetcher);
$request = $this->addAuthHeaders($request, $credentialsFetcher);
if ($credentialsFetcher instanceof GetQuotaProjectInterface) {
$quotaProject = $credentialsFetcher->getQuotaProject();
}
}
if ($quotaProject) {
$request = $request->withHeader('X-Goog-User-Project', $quotaProject);
}
} else {
// If we are not signing the request, check the universe domain against "googleapis.com"
$this->checkUniverseDomain(null);
}
return $request;
}
/**
* Adds auth headers to the request.
*
* @param RequestInterface $request
* @param FetchAuthTokenInterface $fetcher
* @return array
* @throws ServiceException
*/
private function addAuthHeaders(RequestInterface $request, FetchAuthTokenInterface $fetcher)
{
$backoff = new ExponentialBackoff($this->retries, $this->getRetryFunction());
try {
return $backoff->execute(
function () use ($request, $fetcher) {
if (!$fetcher instanceof UpdateMetadataInterface ||
(
$fetcher instanceof FetchAuthTokenCache &&
!$fetcher->getFetcher() instanceof UpdateMetadataInterface
)
) {
// This covers an edge case where the token fetcher does not implement UpdateMetadataInterface,
// which only would happen if a user implemented a custom fetcher
if ($token = $fetcher->fetchAuthToken($this->authHttpHandler)) {
return $request->withHeader('authorization', 'Bearer ' . $token['access_token']);
}
} else {
$headers = $fetcher->updateMetadata($request->getHeaders(), null, $this->authHttpHandler);
return Utils::modifyRequest($request, ['set_headers' => $headers]);
}
// As we do not know the reason the credentials fetcher could not fetch the
// token, we should not retry.
throw new \RuntimeException('Unable to fetch token');
}
);
} catch (\Exception $ex) {
throw $this->convertToGoogleException($ex);
}
}
/**
* Convert any exception to a Google Exception.
*
* @param \Exception $ex
* @return Exception\ServiceException
*/
private function convertToGoogleException(\Exception $ex)
{
switch ($ex->getCode()) {
case 400:
$exception = Exception\BadRequestException::class;
break;
case 404:
$exception = Exception\NotFoundException::class;
break;
case 409:
$exception = Exception\ConflictException::class;
break;
case 412:
$exception = Exception\FailedPreconditionException::class;
break;
case 500:
$exception = Exception\ServerException::class;
break;
case 504:
$exception = Exception\DeadlineExceededException::class;
break;
default:
$exception = Exception\ServiceException::class;
break;
}
return new $exception($this->getExceptionMessage($ex), $ex->getCode(), $ex);
}
/**
* Gets the exception message.
*
* @access private
* @param \Exception $ex
* @return string
*/
private function getExceptionMessage(\Exception $ex)
{
if ($ex instanceof RequestException && $ex->hasResponse()) {
return (string) $ex->getResponse()->getBody();
}
return $ex->getMessage();
}
/**
* Gets a set of request options.
*
* @param array $options
* @return array
*/
private function getRequestOptions(array $options)
{
$restOptions = $options['restOptions'] ?? $this->restOptions;
$timeout = $options['requestTimeout'] ?? $this->requestTimeout;
if ($timeout && !array_key_exists('timeout', $restOptions)) {
$restOptions['timeout'] = $timeout;
}
return $restOptions;
}
/**
* Gets a set of retry options.
*
* @param array $options
* @return array
*/
private function getRetryOptions(array $options)
{
return [
'retries' => isset($options['retries'])
? $options['retries']
: $this->retries,
'retryFunction' => isset($options['restRetryFunction'])
? $options['restRetryFunction']
: $this->retryFunction,
'retryListener' => isset($options['restRetryListener'])
? $options['restRetryListener']
: null,
'delayFunction' => isset($options['restDelayFunction'])
? $options['restDelayFunction']
: $this->delayFunction,
'calcDelayFunction' => isset($options['restCalcDelayFunction'])
? $options['restCalcDelayFunction']
: $this->calcDelayFunction
];
}
/**
* Builds the default async HTTP handler.
*
* @return callable
*/
private function buildDefaultAsyncHandler()
{
return $this->httpHandler instanceof Guzzle6HttpHandler
? [$this->httpHandler, 'async']
: [HttpHandlerFactory::build(), 'async'];
}
/**
* Verify that the expected universe domain matches the universe domain from the credentials.
*/
private function checkUniverseDomain(?FetchAuthTokenInterface $credentialsFetcher = null)
{
if (false === $this->hasCheckedUniverse) {
if ($this->universeDomain === '') {
throw new GoogleException('The universe domain cannot be empty.');
}
if (is_null($credentialsFetcher)) {
if ($this->universeDomain !== GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN) {
throw new GoogleException(sprintf(
'The accessToken option is not supported outside of the default universe domain (%s).',
GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN
));
}
} else {
$credentialsUniverse = $credentialsFetcher instanceof GetUniverseDomainInterface
? $credentialsFetcher->getUniverseDomain()
: GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN;
if ($credentialsUniverse !== $this->universeDomain) {
throw new GoogleException(sprintf(
'The configured universe domain (%s) does not match the credential universe domain (%s)',
$this->universeDomain,
$credentialsUniverse
));
}
}
$this->hasCheckedUniverse = true;
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/RequestWrapperTrait.php
================================================
new MemoryCacheItemPool(),
'authCacheOptions' => [],
'credentialsFetcher' => null,
'keyFile' => null,
'requestTimeout' => null,
'retries' => 3,
'scopes' => null,
'quotaProject' => null
];
if ($config['credentialsFetcher'] && !$config['credentialsFetcher'] instanceof FetchAuthTokenInterface) {
throw new \InvalidArgumentException('credentialsFetcher must implement FetchAuthTokenInterface.');
}
if (!$config['authCache'] instanceof CacheItemPoolInterface) {
throw new \InvalidArgumentException('authCache must implement CacheItemPoolInterface.');
}
$this->authCache = $config['authCache'];
$this->authCacheOptions = $config['authCacheOptions'];
$this->credentialsFetcher = $config['credentialsFetcher'];
$this->retries = $config['retries'];
$this->scopes = $config['scopes'];
$this->keyFile = $config['keyFile'];
$this->requestTimeout = $config['requestTimeout'];
$this->quotaProject = $config['quotaProject'];
}
/**
* Get the Keyfile.
*
* @return array
*/
public function keyFile()
{
return $this->keyFile;
}
/**
* Get the scopes
*
* @return array
*/
public function scopes()
{
return $this->scopes;
}
/**
* Gets the credentials fetcher and sets up caching. Precedence is as
* follows:
*
* - A user supplied credentials fetcher instance.
* - Credentials created from a keyfile.
* - Application default credentials.
* - Anonymous credentials.
*
* @return FetchAuthTokenInterface
*/
public function getCredentialsFetcher()
{
$fetcher = null;
if ($this->credentialsFetcher) {
$fetcher = $this->credentialsFetcher;
} else {
if ($this->keyFile) {
if ($this->quotaProject) {
$this->keyFile['quota_project_id'] = $this->quotaProject;
}
$fetcher = CredentialsLoader::makeCredentials($this->scopes, $this->keyFile);
} else {
try {
$fetcher = $this->getADC();
} catch (\DomainException $ex) {
$fetcher = new AnonymousCredentials();
}
}
// Note: If authCache is set and keyFile is not set, the resulting
// credentials instance will be FetchAuthTokenCache, and we will be
// unable to enable "useJwtAccessWithScope". This is unlikely, as
// keyFile is automatically set in ClientTrait::configureAuthentication,
// and so should always exist when ServiceAccountCredentials are in use.
if ($fetcher instanceof ServiceAccountCredentials) {
$fetcher->useJwtAccessWithScope();
}
}
if ($fetcher instanceof FetchAuthTokenCache) {
// The fetcher has already been wrapped in a cache by `ApplicationDefaultCredentials`;
// no need to wrap it another time.
return $fetcher;
} else {
return new FetchAuthTokenCache(
$fetcher,
$this->authCacheOptions,
$this->authCache
);
}
}
/**
* Returns application default credentials. Abstracted out for unit testing.
*
* @return FetchAuthTokenInterface
* @throws \DomainException
*/
protected function getADC()
{
return ApplicationDefaultCredentials::getCredentials(
$this->scopes,
$this->authHttpHandler,
$this->authCacheOptions,
$this->authCache,
$this->quotaProject
);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/RestTrait.php
================================================
requestBuilder = $requestBuilder;
}
/**
* Sets the request wrapper.
*
* @param RequestWrapper $requestWrapper Wrapper used to handle sending
* requests to the JSON API.
*/
public function setRequestWrapper(RequestWrapper $requestWrapper)
{
$this->requestWrapper = $requestWrapper;
}
/**
* Get the RequestWrapper.
*
* @return RequestWrapper|null
*/
public function requestWrapper()
{
return $this->requestWrapper;
}
/**
* Delivers a request built from the service definition.
*
* @param string $resource The resource type used for the request.
* @param string $method The method used for the request.
* @param array $options [optional] Options used to build out the request.
* @param array $whitelisted [optional]
* @return array
* @throws ServiceException
*/
public function send($resource, $method, array $options = [], $whitelisted = false)
{
$options += [
'prettyPrint' => false,
];
$requestOptions = $this->pluckArray([
'restOptions',
'retries',
'retryHeaders',
'requestTimeout',
'restRetryFunction',
'restRetryListener',
'restDelayFunction',
'restCalcDelayFunction',
], $options);
try {
return json_decode(
$this->requestWrapper->send(
$this->requestBuilder->build($resource, $method, $options),
$requestOptions
)->getBody(),
true
);
} catch (NotFoundException $e) {
if ($whitelisted) {
throw $this->modifyWhitelistedError($e);
}
throw $e;
}
}
/**
* Return a custom API endpoint in the proper format, or default if none provided.
*
* @param string $default
* @param array $config
* @param string $apiEndpointTemplate
* @return string
*/
private function getApiEndpoint($default, array $config, ?string $apiEndpointTemplate = null)
{
// If the $default parameter is provided, or the user has set an "apiEndoint" config option,
// fall back to the previous behavior.
if ($res = $config['apiEndpoint'] ?? $default) {
if (substr($res, -1) !== '/') {
$res = $res . '/';
}
if (strpos($res, '//') === false) {
$res = 'https://' . $res;
}
return $res;
}
// One of the $default or the $template must always be set
if (!$apiEndpointTemplate) {
throw new UnexpectedValueException(
'An API endpoint template must be provided if no "apiEndpoint" or default endpoint is set.'
);
}
if (!isset($config['universeDomain'])) {
throw new UnexpectedValueException(
'The "universeDomain" config value must be set to use the default API endpoint template.'
);
}
$apiEndpoint = str_replace(
'UNIVERSE_DOMAIN',
$config['universeDomain'],
$apiEndpointTemplate
);
// Preserve the behavior of guaranteeing a trailing "/"
return $apiEndpoint . (substr($apiEndpoint, -1) !== '/' ? '/' : '');
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Retry.php
================================================
(int >= 0), 'nanos' => (int >= 0)] specifying how
* long an operation should pause before retrying. Should accept a
* single argument of type `\Exception`.
* @param callable $retryFunction [optional] returns bool for whether or not
* to retry.
*/
public function __construct(
$retries,
callable $delayFunction,
?callable $retryFunction = null
) {
$this->retries = $retries !== null ? (int) $retries : 3;
$this->delayFunction = $delayFunction;
$this->retryFunction = $retryFunction;
}
/**
* Executes the retry process.
*
* @param callable $function
* @param array $arguments [optional]
* @return mixed
* @throws \Exception The last exception caught while retrying.
*/
public function execute(callable $function, array $arguments = [])
{
$delayFunction = $this->delayFunction;
$retryAttempt = 0;
$continue = true;
do {
try {
$res = call_user_func_array($function, $arguments);
$continue = false;
return $res;
} catch (\Exception $exception) {
if ($this->retryFunction) {
if (!call_user_func($this->retryFunction, $exception, $retryAttempt)) {
throw $exception;
}
}
if ($retryAttempt < $this->retries) {
$delay = $delayFunction($exception);
$delay += [
'seconds' => 0,
'nanos' => 0
];
time_nanosleep($delay['seconds'], $delay['nanos']);
$retryAttempt++;
} else {
$continue = false;
throw $exception;
}
}
} while ($continue);
}
/**
* @param callable $delayFunction
* @return void
*/
public function setDelayFunction(callable $delayFunction)
{
$this->delayFunction = $delayFunction;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/RetryDeciderTrait.php
================================================
httpRetryCodes;
$httpRetryMessages = $this->httpRetryMessages;
return function (\Exception $ex) use ($httpRetryCodes, $httpRetryMessages, $shouldRetryMessages) {
$statusCode = $ex->getCode();
if (in_array($statusCode, $httpRetryCodes)) {
return true;
}
if (!$shouldRetryMessages) {
return false;
}
$message = ($ex instanceof RequestException && $ex->hasResponse())
? (string) $ex->getResponse()->getBody()
: $ex->getMessage();
try {
$message = $this->jsonDecode(
$message,
true
);
} catch (\InvalidArgumentException $ex) {
return false;
}
if (!isset($message['error']['errors'])) {
return false;
}
foreach ($message['error']['errors'] as $error) {
if (in_array($error['reason'], $httpRetryMessages)) {
return true;
}
}
return false;
};
}
/**
* @param array $codes
*/
private function setHttpRetryCodes(array $codes)
{
$this->httpRetryCodes = $codes;
}
/**
* @param array $messages
*/
private function setHttpRetryMessages(array $messages)
{
$this->httpRetryMessages = $messages;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/ServiceBuilder.php
================================================
'myAwesomeProject'
* ]);
* ```
*
* @param array $config [optional] {
* Configuration options.
*
* @type string $projectId The project ID from the Google Developer's
* Console.
* @type CacheItemPoolInterface $authCache A cache for storing access
* tokens. **Defaults to** a simple in memory implementation.
* @type array $authCacheOptions Cache configuration options.
* @type callable $authHttpHandler A handler used to deliver Psr7
* requests specifically for authentication.
* @type callable $httpHandler A handler used to deliver Psr7 requests.
* Only valid for requests sent over REST.
* @type array $keyFile [DEPRECATED]
* @type string $keyFilePath [DEPRECATED]
* @type int $retries Number of retries for a failed request.
* **Defaults to** `3`.
* @type array $scopes Scopes to be used for the request.
* }
*/
public function __construct(array $config = [])
{
$this->config = $this->resolveConfig($config);
}
/**
* Google Cloud BigQuery allows you to create, manage, share and query
* data. Find more information at the
* [Google Cloud BigQuery Docs](https://cloud.google.com/bigquery/docs).
*
* Example:
* ```
* $bigQuery = $cloud->bigQuery();
* ```
*
* @param array $config [optional] {
* Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options.
*
* @type bool $returnInt64AsObject If true, 64 bit integers will be
* returned as a {@see \Google\Cloud\Core\Int64} object for 32 bit
* platform compatibility. **Defaults to** false.
* @type string $location If provided, determines the default geographic
* location used when creating datasets and managing jobs. Please
* note: This is only required for jobs started outside of the US
* and EU regions. Also, if location metadata has already been
* fetched over the network it will take precedent over this
* setting.
* }
* @return BigQueryClient
*/
public function bigQuery(array $config = [])
{
return $this->createClient(BigQueryClient::class, 'bigquery', $config);
}
/**
* Google Cloud Datastore is a highly-scalable NoSQL database for your
* applications. Find more information at the
* [Google Cloud Datastore docs](https://cloud.google.com/datastore/docs/).
*
* Example:
* ```
* $datastore = $cloud->datastore();
* ```
*
* @param array $config [optional] {
* Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options.
*
* @type bool $returnInt64AsObject If true, 64 bit integers will be
* returned as a {@see \Google\Cloud\Core\Int64} object for 32 bit
* platform compatibility. **Defaults to** false.
* @return DatastoreClient
*/
public function datastore(array $config = [])
{
return $this->createClient(DatastoreClient::class, 'datastore', $config);
}
/**
* Cloud Firestore is a flexible, scalable, realtime database for mobile,
* web, and server development. Find more information at the
* [Google Cloud firestore docs](https://cloud.google.com/firestore/docs/).
*
* Example:
* ```
* $firestore = $cloud->firestore();
* ```
*
* @param array $config [optional] {
* Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options.
*
* @type bool $returnInt64AsObject If true, 64 bit integers will be
* returned as a {@see \Google\Cloud\Core\Int64} object for 32 bit
* platform compatibility. **Defaults to** false.
* @return FirestoreClient
*/
public function firestore(array $config = [])
{
return $this->createClient(FirestoreClient::class, 'firestore', $config);
}
/**
* Google Stackdriver Logging allows you to store, search, analyze, monitor,
* and alert on log data and events from Google Cloud Platform and Amazon
* Web Services. Find more information at the
* [Google Stackdriver Logging docs](https://cloud.google.com/logging/docs/).
*
* Example:
* ```
* $logging = $cloud->logging();
* ```
*
* @param array $config [optional] Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the available options.
* @return LoggingClient
*/
public function logging(array $config = [])
{
return $this->createClient(LoggingClient::class, 'logging', $config);
}
/**
* Google Cloud Natural Language provides natural language understanding
* technologies to developers, including sentiment analysis, entity
* recognition, and syntax analysis. Currently only English, Spanish,
* and Japanese textual context are supported. Find more information at the
* [Google Cloud Natural Language docs](https://cloud.google.com/natural-language/docs/).
*
* Example:
* ```
* $language = $cloud->language();
* ```
*
* @param array $config [optional] Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the available options.
* @return LanguageServiceClient
*/
public function language(array $config = [])
{
if (class_exists(DeprecatedLanguageClient::class)) {
return $this->createClient(DeprecatedLanguageClient::class, 'vision', $config);
}
throw new \BadMethodCallException(sprintf(
'This method is no longer supported, create %s directly instead.',
LanguageServiceClient::class
));
}
/**
* Google Cloud Pub/Sub allows you to send and receive messages between
* independent applications. Find more information at the
* [Google Cloud Pub/Sub docs](https://cloud.google.com/pubsub/docs/).
*
* Example:
* ```
* $pubsub = $cloud->pubsub(['projectId' => 'my-project']);
* ```
*
* @param array $config [optional] {
* Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options.
*
* @type string $transport The transport type used for requests. May be
* either `grpc` or `rest`. **Defaults to** `grpc` if gRPC support
* is detected on the system.
* @return PubSubClient
*/
public function pubsub(array $config = [])
{
return $this->createClient(PubSubClient::class, 'pubsub', $config);
}
/**
* Google Cloud Spanner is a highly scalable, transactional, managed, NewSQL
* database service. Find more information at
* [Google Cloud Spanner API docs](https://cloud.google.com/spanner/).
*
* Example:
* ```
* $spanner = $cloud->spanner(['projectId' => 'my-project']);
* ```
*
* @param array $config [optional] {
* Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the other available options.
*
* @type bool $returnInt64AsObject If true, 64 bit integers will be
* returned as a {@see \Google\Cloud\Core\Int64} object for 32 bit
* platform compatibility. **Defaults to** false.
* }
* @return SpannerClient
*/
public function spanner(array $config = [])
{
return $this->createClient(SpannerClient::class, 'spanner', $config);
}
/**
* @deprecated
* @see SpeechClient
* @throws \BadMethodCallException
*/
public function speech(array $config = [])
{
if (class_exists(DeprecatedSpeechClient::class)) {
return $this->createClient(DeprecatedSpeechClient::class, 'speech', $config);
}
throw new \BadMethodCallException(sprintf(
'This method is no longer supported, create %s directly instead.',
SpeechClient::class
));
}
/**
* Google Cloud Storage allows you to store and retrieve data on Google's
* infrastructure. Find more information at the
* [Google Cloud Storage API docs](https://developers.google.com/storage).
*
* Example:
* ```
* $storage = $cloud->storage();
* ```
*
* @param array $config [optional] Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the available options.
* @return StorageClient
*/
public function storage(array $config = [])
{
return $this->createClient(StorageClient::class, 'storage', $config);
}
/**
* Google Stackdriver Trace allows you to collect latency data from your applications
* and display it in the Google Cloud Platform Console. Find more information at
* [Stackdriver Trace API docs](https://cloud.google.com/trace/docs/).
*
* Example:
* ```
* $trace = $cloud->trace();
* ```
*
* @param array $config [optional] Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the available options.
* @return TraceClient
*/
public function trace(array $config = [])
{
return $this->createClient(TraceClient::class, 'trace', $config);
}
/**
* @deprecated
* @see ImageAnnotatorClient
* @throws \BadMethodCallException
*/
public function vision(array $config = [])
{
if (class_exists(DeprecatedVisionClient::class)) {
return $this->createClient(DeprecatedVisionClient::class, 'vision', $config);
}
throw new \BadMethodCallException(sprintf(
'This method is no longer supported, create %s directly instead.',
ImageAnnotatorClient::class
));
}
/**
* @deprecated
* @see TranslationServiceClient
* @throws \BadMethodCallException
*/
public function translate(array $config = [])
{
if (class_exists(DeprecatedTranslateClient::class)) {
return $this->createClient(DeprecatedTranslateClient::class, 'translate', $config);
}
throw new \BadMethodCallException(sprintf(
'This method is no longer supported, create %s directly instead.',
TranslationServiceClient::class
));
}
/**
* Create the client library, or error if not installed.
*
* @param string $class The class to create.
* @param string $packageName The name of the package
* @param array $config Configuration options.
*/
private function createClient($class, $packageName, array $config = [])
{
if (class_exists($class)) {
return new $class($this->resolveConfig($config + $this->config));
}
throw new \Exception(sprintf(
'The google/cloud-%s package is missing and must be installed.',
$packageName
));
}
/**
* Resolves configuration options.
*
* @param array $config
* @return array
*/
private function resolveConfig(array $config)
{
if (!isset($config['httpHandler'])) {
$config['httpHandler'] = HttpHandlerFactory::build();
}
if (!isset($config['asyncHttpHandler'])) {
$config['asyncHttpHandler'] = $config['httpHandler'] instanceof Guzzle6HttpHandler
? [$config['httpHandler'], 'async']
: [HttpHandlerFactory::build(), 'async'];
}
return array_merge($this->config, $config);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/SysvTrait.php
================================================
value = $value;
$this->util = $util ?: new StringUtil();
}
/**
* @param mixed $argument
* @return bool|int
*
* @experimental
* @internal
*/
public function scoreArgument($argument)
{
return $this->compare($this->value, $argument) ? 11 : false;
}
private function compare(array $value, array $argument)
{
array_multisort($value);
array_multisort($argument);
return $value == $argument;
}
/**
* @return bool
*
* @experimental
* @internal
*/
public function isLast()
{
return false;
}
/**
* @return string
*
* @experimental
* @internal
*/
public function __toString()
{
if ($this->string) {
$string = $this->string .': (%s)';
} else {
$string = 'same(%s)';
}
return sprintf($string, $this->util->stringify($this->value));
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/CheckForClassTrait.php
================================================
markTestSkipped("Missing required class: $class");
return;
}
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/DatastoreOperationRefreshTrait.php
================================================
null,
'returnInt64AsObject' => false,
'encode' => false
];
$mapper = new EntityMapper(
$options['projectId'],
$options['encode'],
$options['returnInt64AsObject']
);
$stub->___setProperty('operation', new Operation(
$connection,
$options['projectId'],
$options['returnInt64AsObject'],
$mapper
));
return $stub;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/FileListFilterIterator.php
================================================
projectRootPath = $projectRootPath;
$this->fileTypes = $fileTypes;
$this->testPaths = $testPaths;
$this->excludes = $excludes;
parent::__construct($iterator);
}
/**
* Decides whether to include the file or exclude it.
*
* @return bool
*
* @experimental
* @internal
*/
#[\ReturnTypeWillChange]
public function accept()
{
/** @var \SplFileInfo */
$file = parent::current();
$path = '/' . trim(str_replace($this->projectRootPath, '', realpath($file->getPathName())), '/');
if (!in_array($file->getExtension(), $this->fileTypes)) {
return false;
}
foreach ($this->excludes as $exclude) {
if ($exclude instanceof RegexFileFilter) {
$pattern = $exclude->regex;
if (preg_match($pattern, $path) === 1) {
return false;
}
continue;
}
if (strpos($exclude, '/') !== 0 && strpos($path, $exclude) !== false) {
return false;
}
if (strpos($path, $exclude) === 0) {
return false;
}
}
foreach ($this->testPaths as $testPath) {
if (strpos($path, $testPath) !== false) {
return false;
}
}
return true;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/GcTestListener.php
================================================
markTestSkipped('Must have the grpc extension installed to run this test.');
}
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('gRPC is not supported on HHVM.');
}
}
/**
* @return bool True if grpc tests should be skipped, otherwise false
*
* @experimental
* @internal
*/
public function shouldSkipGrpcTests()
{
return !extension_loaded('grpc') || defined('HHVM_VERSION');
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/KeyPairGenerateTrait.php
================================================
withPadding(RSA3::SIGNATURE_PKCS1)
->withHash('sha256');
return [$key->toString('PKCS1'), $key->getPublicKey()];
}
$rsa = new RSA2;
$rsa->setSignatureMode(RSA2::SIGNATURE_PKCS1);
$rsa->setHash('sha256');
$key = $rsa->createKey();
usleep(500);
return [$key['privatekey'], $key['publickey']];
}
private function verifySignature($privateKey, $input, $signature)
{
$verify = $this->signString($privateKey, $input);
return urlencode(base64_encode($verify)) === $signature;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/Lock/MockGlobals.php
================================================
tagFactory = $tagFactory;
}
public function getTagFactory()
{
return $this->tagFactory;
}
/**
* Returns the parsed text of this description.
*/
public function create(string $contents, ?TypeContext $context = null): Description
{
$tokens = $this->lex($contents);
$count = count($tokens);
$tagCount = 0;
$tags = [];
for ($i = 1; $i < $count; $i += 2) {
$tags[] = $this->tagFactory->create($tokens[$i], $context);
$tokens[$i] = '%' . ++$tagCount . '$s';
}
//In order to allow "literal" inline tags, the otherwise invalid
//sequence "{@}" is changed to "@", and "{}" is changed to "}".
//"%" is escaped to "%%" because of vsprintf.
//See unit tests for examples.
for ($i = 0; $i < $count; $i += 2) {
// @TODO: Modified the following line so that "{}" is not replaced
// with "}". So far we have not seen any adverse effects
// $tokens[$i] = str_replace(['{@}', '{}', '%'], ['@', '}', '%%'], $tokens[$i]);
$tokens[$i] = str_replace(['{@}', '%'], ['@', '%%'], $tokens[$i]);
}
return new Description(implode('', $tokens), $tags);
}
/**
* Strips the contents from superfluous whitespace and splits the description into a series of tokens.
*
* @return string[] A series of tokens of which the description text is composed.
*/
private function lex(string $contents): array
{
$contents = $this->removeSuperfluousStartingWhitespace($contents);
// performance optimalization; if there is no inline tag, don't bother splitting it up.
if (strpos($contents, '{@') === false) {
return [$contents];
}
return Utils::pregSplit(
'/\{
# "{@}" is not a valid inline tag. This ensures that we do not treat it as one, but treat it literally.
(?!@\})
# We want to capture the whole tag line, but without the inline tag delimiters.
(\@
# Match everything up to the next delimiter.
[^{}]*
# Nested inline tag content should not be captured, or it will appear in the result separately.
(?:
# Match nested inline tags.
(?:
# Because we did not catch the tag delimiters earlier, we must be explicit with them here.
# Notice that this also matches "{}", as a way to later introduce it as an escape sequence.
\{(?1)?\}
|
# Make sure we match hanging "{".
\{
)
# Match content after the nested inline tag.
[^{}]*
)* # If there are more inline tags, match them as well. We use "*" since there may not be any
# nested inline tags.
)
\}/Sux',
$contents,
0,
PREG_SPLIT_DELIM_CAPTURE
);
}
/**
* Removes the superfluous from a multi-line description.
*
* When a description has more than one line then it can happen that the second and subsequent lines have an
* additional indentation. This is commonly in use with tags like this:
*
* {@}since 1.1.0 This is an example
* description where we have an
* indentation in the second and
* subsequent lines.
*
* If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent
* lines and this may cause rendering issues when, for example, using a Markdown converter.
*/
private function removeSuperfluousStartingWhitespace(string $contents): string
{
$lines = explode("\n", $contents);
// if there is only one line then we don't have lines with superfluous whitespace and
// can use the contents as-is
if (count($lines) <= 1) {
return $contents;
}
// determine how many whitespace characters need to be stripped
$startingSpaceCount = 9999999;
for ($i = 1, $iMax = count($lines); $i < $iMax; ++$i) {
// lines with a no length do not count as they are not indented at all
if (trim($lines[$i]) === '') {
continue;
}
// determine the number of prefixing spaces by checking the difference in line length before and after
// an ltrim
$startingSpaceCount = min($startingSpaceCount, strlen($lines[$i]) - strlen(ltrim($lines[$i])));
}
// strip the number of spaces from each line
if ($startingSpaceCount > 0) {
for ($i = 1, $iMax = count($lines); $i < $iMax; ++$i) {
$lines[$i] = substr($lines[$i], $startingSpaceCount);
}
}
return implode("\n", $lines);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/Reflection/ReflectionHandlerFactory.php
================================================
descriptionFactory = $this->createDescriptionFactory();
$this->docBlockFactory = $this->createDocBlockFactory($this->descriptionFactory);
}
/**
* @param string $class
* @return DocBlock
*/
public function createDocBlock($classOrMethod)
{
return $this->docBlockFactory->create($classOrMethod);
}
/**
* @param DocBlock $docBlock
* @return string
*/
public function getDocBlockText(DocBlock $docBlock)
{
$description = $this->descriptionFactory->create(
$docBlock->getSummary() . "\n\n" . $docBlock->getDescription(),
$docBlock->getContext()
);
return $description->render();
}
/**
* @param array $files
* @return string[]
*/
public function classes(array $files)
{
$projectFactory = $this->createProjectFactory();
$localFiles = [];
foreach ($files as $file) {
$localFiles[] = new LocalFile($file);
}
$project = $projectFactory->create('My Project', $localFiles);
$classes = [];
foreach ($files as $file) {
$classesInFile = $project->getFiles()[$file]->getClasses();
foreach ($classesInFile as $class) {
$classes[] = (string) $class->getFqsen();
}
}
return $classes;
}
/**
* @return ProjectFactory
*/
public function createProjectFactory()
{
$phpVersion = PhpVersion::fromString('8.1'); // PHP 8.1.0
$parser = (new ParserFactory())->createForVersion($phpVersion);
$nodeTraverser = new NodeTraverser();
$nodeTraverser->addVisitor(new NameResolver());
$nodeTraverser->addVisitor(new ElementNameResolver());
$nodesFactory = new NodesFactory($parser, $nodeTraverser);
$docblockFactory = $this->createDocBlockFactory($this->createDescriptionFactory());
$methodStrategy = new Factory\Method($docblockFactory);
$strategies = new ProjectFactoryStrategies(
[
new Factory\Namespace_(),
new Factory\Class_($docblockFactory),
new Factory\Enum_($docblockFactory),
new Factory\EnumCase($docblockFactory, new PrettyPrinter()),
new Factory\Define($docblockFactory, new PrettyPrinter()),
new Factory\GlobalConstant($docblockFactory, new PrettyPrinter()),
new Factory\ClassConstant($docblockFactory, new PrettyPrinter()),
new Factory\File($docblockFactory, $nodesFactory),
new Factory\Function_($docblockFactory),
new Factory\Interface_($docblockFactory),
$methodStrategy,
new Factory\Property($docblockFactory, new PrettyPrinter()),
new Factory\Trait_($docblockFactory),
new Factory\IfStatement(),
new TraitUse(),
]
);
$strategies->addStrategy(
new Factory\ConstructorPromotion($methodStrategy, $docblockFactory, new PrettyPrinter()),
1100
);
$strategies->addStrategy(new Noop(), -PHP_INT_MAX);
return new ProjectFactory($strategies);
}
/**
* @return DescriptionFactory
*/
public function createDescriptionFactory()
{
$fqsenResolver = new FqsenResolver();
$tagFactory = new StandardTagFactory($fqsenResolver);
$descriptionFactory = new CoreDescriptionFactory($tagFactory);
$tagFactory->addService($descriptionFactory, DescriptionFactory::class);
$tagFactory->addService(new TypeResolver($fqsenResolver));
return $descriptionFactory;
}
/**
* @return DocBlockFactory
*/
private function createDocBlockFactory($descriptionFactory)
{
$tagFactory = $descriptionFactory->getTagFactory();
return new DocBlockFactory($descriptionFactory, $tagFactory);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/RegexFileFilter.php
================================================
regex = $regex;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/Snippet/Container.php
================================================
scanner = $scanner;
}
private function getSnippetExcludeList()
{
return static::$snippetExcludeList;
}
/**
* Creates a list of all snippets which should be covered.
*
* @return Snippet[]
*
* @experimental
* @internal
*/
public function buildListToCover()
{
$files = $this->scanner->files();
$classes = $this->scanner->classes($files, $this->getSnippetExcludeList());
$this->snippets = $this->scanner->snippets($classes);
return $this->snippets;
}
/**
* Mark a snippet as covered.
*
* @param string $identifier The identifier of the snippet being covered.
* @return void
*
* @experimental
* @internal
*/
public function cover($identifier)
{
$this->covered[] = $identifier;
}
/**
* Return a list of all snippets not marked a covered.
*
* @return Snippet[]
*
* @experimental
* @internal
*/
public function uncovered()
{
return array_diff_key($this->snippets, array_flip($this->covered));
}
/**
* @param string|int $identifier
* @return Snippet|null
*
* @experimental
* @internal
*/
public function cache($identifier)
{
return (array_key_exists($identifier, $this->snippets))
? $this->snippets[$identifier]
: null;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ExcludeFilter.php
================================================
excludeDirs = $excludeDirs;
}
/**
* @return bool Determines whether to accept or exclude a path
*/
#[\ReturnTypeWillChange]
public function accept()
{
// Accept the current item if we can recurse into it
// or it is a value starting with "test"
foreach ($this->excludeDirs as $excludeDir) {
if (strpos($this->current(), $excludeDir) !== false) {
return false;
}
}
return true;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/Snippet/Coverage/Scanner.php
================================================
parser = $parser;
if (is_string($basePath)) {
$basePath = [$basePath];
}
$this->basePath = $basePath;
$this->exclude = $exclude;
}
/**
* Retrieve a list of PHP files to scan.
*
* @return string[]
*
* @experimental
* @internal
*/
public function files()
{
$files = [];
foreach ($this->basePath as $path) {
$directoryIterator = new \RecursiveDirectoryIterator($path);
$iterator = new \RecursiveIteratorIterator($directoryIterator);
$fileList = new FileListFilterIterator(
$path,
$iterator,
['php'],
[
'/tests/'
],
$this->exclude
);
foreach ($fileList as $item) {
array_push($files, realPath($item->getPathName()));
}
}
return $files;
}
private function checkExclude($className, array $exclude)
{
foreach ($exclude as $pattern) {
if (preg_match($pattern, $className)) {
return true;
}
}
return false;
}
/**
* Retrieve a list of classes in the given PHP files.
*
* @param array $files
* @param array $exclude
* @return string[]
*
* @experimental
* @internal
*/
public function classes(array $files, array $exclude = [])
{
$handler = ReflectionHandlerFactory::create();
$classes = [];
foreach ($handler->classes($files) as $class) {
if ($this->checkExclude($class, $exclude)) {
continue;
}
$classes[] = $class;
}
return $classes;
}
/**
* Get a list of all snippets from the given classes.
*
* @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[]
*
* @experimental
* @internal
* @throws \ReflectionException
*/
public function snippets(array $classes)
{
$snippets = [];
foreach ($classes as $class) {
try {
$snippets = array_merge(
$snippets,
$this->parser->allExamples(new \ReflectionClass($class))
);
} catch (\ReflectionException $e) {
throw new \RuntimeException(sprintf(
"Error in class %s: %s",
$class,
$e->getMessage()
));
}
}
return $snippets;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/Snippet/Coverage/ScannerInterface.php
================================================
returnVal = $returnVal;
$this->output = $output;
}
/**
* @return mixed
*/
public function returnVal()
{
return $this->returnVal;
}
/**
* @return mixed
*/
public function output()
{
return $this->output;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/Snippet/Parser/Parser.php
================================================
reflection = ReflectionHandlerFactory::create();
}
/**
* Get a snippet from a class.
*
* Example:
* ```
* use Google\Cloud\Core\Testing\Snippet\Parser\Parser;
*
* $snippet = $parser->classExample(Parser::class);
* ```
*
* @param string $class the name of the class
* @param int|string $index The index of the example to return.
* @return Snippet
* @throws \Exception
*/
public function classExample($class, $index = 0)
{
$class = new ReflectionClass($class);
$examples = $this->examplesFromClass($class);
$result = array_filter($examples, function ($example) use ($index) {
return ($example->index() == $index);
});
if (empty($result)) {
throw new \Exception(sprintf(
'Given snippet index %d does not exist for class %s',
$index,
$class->getName()
));
}
return current($result);
}
/**
* Get a snippet from a method.
*
* Example:
* ```
* use Google\Cloud\Core\Testing\Snippet\Parser\Parser;
*
* $snippet = $parser->methodExample(Parser::class, 'methodExample');
* ```
*
* ```
* use Google\Cloud\Core\Testing\Snippet\Parser\Parser;
*
* // Get the 2nd example (index=1)
* $snippet = $parser->methodExample(Parser::class, 'methodExample', 1);
* ```
*
* @param string $class The name of the class.
* @param string $method The name of the method.
* @param int $index The 0-indexed example to return.
* @return Snippet
* @throws Exception
*/
public function methodExample($class, $method, $index = 0)
{
$examples = $this->examplesFromMethod($class, $method);
$result = array_filter($examples, function ($example) use ($index) {
return ($example->index() === $index);
});
if (empty($result)) {
throw new \Exception(sprintf(
'Given snippet index %d does not exist for method %s::%s',
$index,
$class,
$method
));
}
return current($result);
}
/**
* Retrieve all examples from a class Doc Block.
*
* Example:
* ```
* $examples = $parser->examplesFromClass($parser);
* ```
*
* @param object|ReflectionClass $class An instance or reflector of the
* class to parse examples from.
* @return array
*/
public function examplesFromClass($class)
{
if (!($class instanceof ReflectionClass)) {
$class = new ReflectionClass($class);
}
if (!$class->getDocComment()) {
return [];
}
$doc = $this->reflection->createDocBlock($class);
$magic = [];
if ($doc->getTags()) {
$magicMethods = array_filter($doc->getTags(), function ($tag) {
return ($tag->getName() === 'method');
});
$methods = $this->buildMagicMethods($magicMethods, $class->getName());
foreach ($methods as $method) {
$magicExamples = $this->examples(
$method['doc'],
$class->getName() .'::'. $method['name'],
$class->getFileName(),
$class->getStartLine()
);
foreach ($magicExamples as $ex) {
$magic[$ex->identifier()] = $ex;
}
}
}
return $this->examples(
$doc,
$class->getName(),
$class->getFileName(),
$class->getStartLine(),
$magic
);
}
/**
* Retrieve all examples from a method's Doc Block.
*
* Example:
* ```
* $examples = $parser->examplesFromMethod($parser, 'examplesFromMethod');
* ```
*
* @param object|string $class An instance of the class to parse examples,
* or the name of the class.
* @param string|ReflectionMethod $method The name of the method to parse
* examples from.
* @return array
*/
public function examplesFromMethod($class, $method)
{
if (!($method instanceof ReflectionMethod)) {
$method = new ReflectionMethod($class, $method);
}
if (!$method->isPublic()) {
return [];
}
if (!$method->getDocComment()) {
return [];
}
$doc = $this->reflection->createDocBlock($method);
$parent = $method->getDeclaringClass();
$class = $parent->getName();
return $this->examples(
$doc,
$class .'::'. $method->getName(),
$method->getFileName(),
$method->getStartLine()
);
}
/**
* Retrieve all examples from a class and its methods.
*
* Example:
* ```
* $examples = $parser->allExamples($parser);
* ```
*
* @param object|ReflectionClass $class An instance or reflector of the class to parse.
* @return array
*/
public function allExamples($class)
{
if (!($class instanceof ReflectionClass)) {
$class = new ReflectionClass($class);
}
$snippets = $this->examplesFromClass($class);
$methods = $class->getMethods();
foreach ($methods as $method) {
if ($method->getDeclaringClass()->name !== $class->getName()) {
continue;
}
$snippets = array_merge($snippets, $this->examplesFromMethod($class, $method));
}
return $snippets;
}
/**
* Parse examples from a DocBlock object.
*
* @param DocBlock $docBlock The DocBlock to parse
* @param string $file The filename the docblock is in
* @param int $line The line where the tested method or class is declared.
* @return array
*/
public function examples(DocBlock $docBlock, $fullyQualifiedName, $file, $line, array $magicMethods = [])
{
$text = $this->reflection->getDocBlockText($docBlock);
$parts = [];
if (strpos($text, 'Example:' . PHP_EOL . '```') !== false) {
$parts = explode('Example:' . PHP_EOL, $text);
} else {
return [];
}
$converter = new Parsedown;
$document = new DOMDocument;
$parsedText = $converter->text($parts[1]);
$document->loadHTML($parsedText);
$examples = $document->getElementsByTagName('code');
$index = 0;
$res = [];
foreach ($examples as $example) {
$name = $this->extractSnippetName($example->textContent);
$indexOrName = $name;
if (!$name) {
$indexOrName = $index;
}
$identifier = $this->createIdentifier($fullyQualifiedName, $indexOrName);
$snippet = new Snippet($identifier, [
'content' => $example->textContent,
'fqn' => $fullyQualifiedName,
'index' => $indexOrName,
'name' => $name,
'file' => $file,
'line' => $line
]);
$res[$identifier] = $snippet;
$index++;
}
$res = array_merge($res, $magicMethods);
return $res;
}
/**
* Create identifier
*
* @param string $fqn
* @param int|string $indexOrName
* @return string
*/
public function createIdentifier($fqn, $indexOrName)
{
return sha1($fqn . $indexOrName);
}
private function extractSnippetName($content)
{
$matches = [];
if (!preg_match(self::SNIPPET_NAME_REGEX, $content, $matches)) {
return null;
}
return $matches[1];
}
private function buildMagicMethods($magicMethods, $className)
{
$res = [];
foreach ($magicMethods as $method) {
$description = $method->getDescription();
if (is_null($description)) {
continue;
}
$class = substr($method->getDescription(), 1, -1);
$doc = $this->reflection->createDocBlock($class);
$res[] = [
'name' => $method->getMethodName(),
'doc' => $doc
];
}
return $res;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/Snippet/Parser/Snippet.php
================================================
identifier = $identifier;
$this->config = $config + [
'content' => '',
'fqn' => '',
'index' => 0,
'file' => '',
'line' => 0,
'name' => null
];
}
/**
* A unique identifier for the snippet.
*
* This identifier is deterministic and will remain constant unless the
* snippet is modified or moved.
*
* @return string
*/
public function identifier()
{
return $this->identifier;
}
/**
* The file in which the snippet is found.
*
* @return string
*/
public function file()
{
return $this->config['file'];
}
/**
* The Snippet fully-qualified name.
*
* @return string
*/
public function fqn()
{
return $this->config['fqn'];
}
/**
* The line number where the snippet's method or class is declared.
*
* Note that this is NOT the line number where the snippet is declared. It
* indicates the method or class which the snippet annotates.
*
* @return int
*/
public function line()
{
return $this->config['line'];
}
/**
* The snippet content.
*
* @return string
*/
public function content()
{
return $this->config['content'];
}
/**
* The Snippet Index
*
* @return int
*/
public function index()
{
return $this->config['index'];
}
/**
* The snippet name
*
* @return string
*/
public function name()
{
return $this->config['name'];
}
/**
* Eval the snippet and return the result.
*
* @return mixed
*/
public function invoke($returnVar = null)
{
$content = $this->config['content'];
$return = ($returnVar)
? sprintf('return %s;', $this->createReturnVar($returnVar))
: '';
$use = [];
foreach ($this->use as $class) {
$use[] = 'use '. $class .';';
}
if (!empty($use)) {
$content = implode("\n", $use) . $content;
}
$cb = function ($return) use ($content) {
extract($this->locals);
try {
ob_start();
$res = eval($content ."\n\n". $return);
$out = ob_get_clean();
} catch (\Exception $e) {
ob_end_clean();
throw $e;
}
return new InvokeResult($res, $out);
};
return $cb($return);
}
/**
* Add a local variable to make available in the snippet execution scope.
*
* @param string $name The variable name
* @param mixed $value The variable value
* @return void
*/
public function addLocal($name, $value)
{
$this->locals[$name] = $value;
}
/**
* Add a local variables to make available in the snippet execution scope.
*
* @param array $locals
* @return void
*/
public function addLocals(array $locals)
{
foreach ($locals as $name => $value) {
$this->addLocal($name, $value);
}
}
/**
* Add a `use` statement for a class.
*
* @param string $name The class name to import.
* @return void
*/
public function addUse($name)
{
$this->use[] = $name;
}
/**
* Replace a line with new code.
*
* Hopefully this is obvious, but be careful using this, and only use it
* when no other feasible options present themselves. It's pretty easy to
* make your test useless when you're overwriting the thing you are trying
* to test.
*
* This is provided for cases when a snippet relies on a global, or on
* something else which can not be overridden or mocked.
*
* @param int $line The line number (0-indexed) to replace.
* @param string $content The PHP code to inject.
* @return void
*/
public function setLine($line, $content)
{
$snippet = explode("\n", $this->config['content']);
$snippet[$line] = $content;
$this->config['content'] = implode("\n", $snippet);
}
/**
* Inject new code after a given line.
*
* Hopefully this is obvious, but be careful using this, and only use it
* when no other feasible options present themselves. It's pretty easy to
* make your test useless when you're modifying the thing you are trying
* to test.
*
* This is provided for cases when a snippet relies on a global, or on
* something else which can not be overridden or mocked.
*
* @param int $line The line number (0-indexed) to write in after.
* @param string $content The PHP code to inject.
* @return void
*/
public function insertAfterLine($line, $content)
{
$snippet = explode("\n", $this->config['content']);
array_splice($snippet, $line+1, 0, $content);
$this->config['content'] = implode("\n", $snippet);
}
/**
* Replace a string in the snippet with a new one.
*
* Hopefully this is obvious, but be careful using this, and only use it
* when no other feasible options present themselves. It's pretty easy to
* make your test useless when you're modifying the thing you are trying
* to test.
*
* This is provided for cases when a snippet relies on a global, or on
* something else which can not be overridden or mocked.
*
* @param string $old The string to be replaced.
* @param string $new The new string to insert.
* @return void
*/
public function replace($old, $new)
{
$this->config['content'] = str_replace($old, $new, $this->config['content']);
}
/**
* Find something with a regex and replace it.
*
* Hopefully this is obvious, but be careful using this, and only use it
* when no other feasible options present themselves. It's pretty easy to
* make your test useless when you're modifying the thing you are trying
* to test.
*
* This is provided for cases when a snippet relies on a global, or on
* something else which can not be overridden or mocked.
*
* @param string $pattern The regex pattern to search for.
* @param string $new The new string to insert.
* @return void
*/
public function regexReplace($pattern, $new)
{
$this->config['content'] = preg_replace($pattern, $new, $this->config['content']);
}
/**
* Serialize to json
*
* @return array
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->config;
}
private function createReturnVar($returnVar)
{
if (is_array($returnVar)) {
foreach ($returnVar as $index => $var) {
$returnVar[$index] = '$'.$var;
}
return '['. implode(',', $returnVar) .']';
}
return '$'. $returnVar;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/Snippet/SnippetTestCase.php
================================================
createIdentifier($class, $indexOrName);
$snippet = self::$coverage->cache($identifier);
if (!$snippet) {
$snippet = self::$parser->classExample($class, $indexOrName);
}
self::$coverage->cover($snippet->identifier());
return clone $snippet;
}
/**
* Retrieve a snippet from a magic method docblock (i.e. `@method` tag
* nexted inside a class-level docblock).
*
* @param string $class The class name
* @param string $method The method name
* @param string|int $indexOrName The index of the snippet, or its name.
* @return Snippet
*
* @experimental
* @internal
*/
public static function snippetFromMagicMethod($class, $method, $indexOrName = 0)
{
$name = $class .'::'. $method;
$identifier = self::$parser->createIdentifier($name, $indexOrName);
$snippet = self::$coverage->cache($identifier);
if (!$snippet) {
throw new \Exception('Magic Method '. $name .' was not found');
}
self::$coverage->cover($identifier);
return clone $snippet;
}
/**
* Retrieve a snippet from a method docblock.
*
* @param string $class The class name
* @param string $method The method name
* @param string|int $indexOrName The index of the snippet, or its name.
* @return Snippet
*
* @experimental
* @internal
*/
public static function snippetFromMethod($class, $method, $indexOrName = 0)
{
$name = $class .'::'. $method;
$identifier = self::$parser->createIdentifier($name, $indexOrName);
$snippet = self::$coverage->cache($identifier);
if (!$snippet) {
$snippet = self::$parser->methodExample($class, $method, $indexOrName);
}
self::$coverage->cover($identifier);
return clone $snippet;
}
/**
* Retrieve a snippet from a markdown file.
*
* @param string $fileName The path to the file
* @param string $header The markdown header the snippet is under
* @param int $index The index of the snippet
* @return Snippet
*
* @experimental
* @internal
*/
public static function snippetFromMarkdown(string $fileName, string $header = '', int $index = 0)
{
// Normalize line endings to \n to make regex handling consistent across platforms
$markdown = str_replace(
["\r\n", "\r"],
"\n",
file_get_contents($fileName)
);
// select by header
if ($header) {
$pattern = '/^#+\s*' . preg_quote($header, '/') . '\s*\n([\s\S]*?)(?=^#+.*$|\Z)/m';
if (!preg_match($pattern, $markdown, $matches)) {
throw new \Exception('Heeader "' . $header . '" not found in markdown file ' . basename($fileName));
}
$markdown = trim($matches[1]);
}
/**
* Regex Explanation:
* * (?m) : Enable multi-line mode (^ matches start of line).
* ^ : Start of a line.
* (\s*) : Group 1: Capture indentation.
* (`{3,}|~{3,}) : Group 2: Capture the fence (3+ backticks or tildes).
* [ \t]* : Consume optional spaces.
* (.*?) : Group 3: Capture the language (and/or extra info) non-greedily.
* \n : End of the opening line.
* ([\s\S]*?) : Group 4: Content (non-greedy).
* \n : Newline before closing fence.
* \1 : Match exact indentation from Group 1.
* \2 : Match exact fence from Group 2.
* \s* : Consume any trailing whitespace/newlines on the closing line.
*/
$pattern = '/^(?m)(\s*)(`{3,}|~{3,})[ \t]*(.*?)\n([\s\S]*?)\1\2\s*$/m';
$snippets = [];
if (!preg_match_all($pattern, $markdown, $matches, PREG_SET_ORDER)) {
throw new \Exception('No snippets found in markdown file ' . basename($fileName));
}
foreach ($matches as $i => $match) {
// Group 3 is the language info string. Trim it to remove extra spaces.
$language = isset($match[3]) ? trim($match[3]) : '';
// Fallback to 'text' if empty
if ($language === '') {
$language = 'text';
}
// Group 4 is the actual code content
$code = $match[4];
$snippets[] = new Snippet($fileName . '-' . $i, [
'content' => $code,
'file' => $fileName,
'index' => $i,
'name' => strtolower($language),
]);
}
if (!isset($snippets[$index])) {
throw new \Exception('No snippet found in markdown file ' . basename($fileName) . ' at index ' . $index);
}
return clone $snippets[$index];
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/Snippet/keyfile-stub.json
================================================
{
"type": "service_account",
"project_id": "my-awesome-project",
"private_key_id": "",
"private_key": "",
"client_email": "",
"client_id": "",
"auth_uri": "",
"token_uri": "",
"auth_provider_x509_cert_url": "",
"client_x509_cert_url": ""
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/StubTrait.php
================================================
___getPropertyReflector($prop);
$property->setAccessible(true);
return $property->getValue($this);
}
/**
* @param $prop
* @param $value
*
* @experimental
* @internal
*/
public function ___setProperty($prop, $value)
{
if (!in_array($prop, json_decode($this->___props))) {
throw new \RuntimeException(sprintf('Property %s cannot be overloaded', $prop));
}
$property = $this->___getPropertyReflector($prop);
$property->setAccessible(true);
$property->setValue($this, $value);
}
private function ___getPropertyReflector($property)
{
$trait = new \ReflectionClass($this);
$ref = $trait->getParentClass() ?: $trait;
// wrap this in a loop that will iterate up a class hierarchy to try
// and find a private property.
$keepTrying = true;
do {
try {
$property = $ref->getProperty($property);
$keepTrying = false;
} catch (\ReflectionException $e) {
if ($ref->getParentClass()) {
$ref = $ref->getParentClass();
} else {
throw new \BadMethodCallException($e->getMessage());
}
}
} while ($keepTrying);
return $property;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/System/DeletionQueue.php
================================================
acceptAllInputs = $acceptAllInputs;
}
/**
* Add an item to be cleaned up.
*
* @param mixed $toDelete Unless the class was created with
* `$acceptAllInputs = true`, either a callable with no arguments, or
* an object with a `delete` method.
* @return void
*
* @experimental
* @internal
*/
public function add($toDelete)
{
if (!$this->acceptAllInputs) {
if (!is_callable($toDelete) && !method_exists($toDelete, 'delete')) {
throw new \BadMethodCallException(
'Deletion Queue requires a callable, or an object with a `delete` method.'
);
}
if (!is_callable($toDelete)) {
$toDelete = function () use ($toDelete) {
$toDelete->delete();
};
}
}
$this->queue[] = $toDelete;
}
/**
* Process all items in the deletion queue.
*
* @return void
* @throws ApiException
*
* @experimental
* @internal
*/
public function process(?callable $action = null)
{
if ($action) {
$action($this->queue);
} else {
$backoff = new ExponentialBackoff(8);
foreach ($this->queue as $item) {
$backoff->execute(function () use ($item) {
try {
call_user_func($item);
} catch (NotFoundException $e) {
} catch (ApiException $apiException) {
if ($apiException->getStatus() !== 'NOT_FOUND') {
throw $apiException;
}
}
});
}
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/System/KeyManager.php
================================================
keyFile = $keyFile;
$this->serviceAccountEmail = $serviceAccountEmail
?: $keyFile['client_email'];
$this->projectId = $projectId
?: $keyFile['project_id'];
$this->setLocation($location ?: self::DEFAULT_LOCATION);
$this->requestWrapper = new RequestWrapper([
'keyFile' => $this->keyFile,
'scopes' => ['https://www.googleapis.com/auth/cloud-platform']
]);
}
/**
* Set the service account email used for IAM management.
*
* @param string $serviceAccountEmail
*/
public function setServiceAccountEmail($serviceAccountEmail)
{
$this->serviceAccountEmail = $serviceAccountEmail;
}
/**
* Set keyring location.
*
* Location name may be in upper or lower case.
*
* @param string $location
*/
public function setLocation($location)
{
$this->location = strtolower($location);
}
/**
* Get the project data.
*
* @param string $projectId [optional] If not provided, uses ID given in
* constructor or keyfile.
* @return array
*/
public function getProject($projectId = null)
{
$projectId = $projectId ?: $this->projectId;
$uri = 'https://cloudresourcemanager.googleapis.com/v1/projects/%s';
$res = $this->requestWrapper->send(
new Request(
'GET',
sprintf($uri, $projectId)
)
);
return json_decode($res->getBody(), true);
}
/**
* A helper to get KMS keys and set correct permissions.
*
* @param string $keyRingId
* @param string[] $keyIds
* @return array
*/
public function getKeyNames($keyRingId, array $keyIds)
{
$keyNames = [];
$this->buildKeyRing($keyRingId);
foreach ($keyIds as $keyId) {
$keyNames[] = $this->getCryptoKeyName(
$keyRingId,
$keyId
);
}
return $keyNames;
}
/**
* @param string $keyRingId
*/
private function buildKeyRing($keyRingId)
{
try {
$this->requestWrapper->send(
new Request(
'POST',
sprintf(
'https://cloudkms.googleapis.com/v1/projects/%s/locations/%s/keyRings?keyRingId=%s',
$this->projectId,
$this->location,
$keyRingId
)
)
);
} catch (ConflictException $ex) {
// If it already exists, great!
}
}
/**
* @param string $keyRingId
* @param string $cryptoKeyId
* @return string
*/
private function getCryptoKeyName(
$keyRingId,
$cryptoKeyId
) {
$name = null;
try {
$uri = 'https://cloudkms.googleapis.com/v1/projects/%s/locations/%s/keyRings/%s/cryptoKeys?cryptoKeyId=%s';
$response = $this->requestWrapper->send(
new Request(
'POST',
sprintf(
$uri,
$this->projectId,
$this->location,
$keyRingId,
$cryptoKeyId
),
[],
json_encode(['purpose' => 'ENCRYPT_DECRYPT'])
)
);
$name = json_decode((string) $response->getBody(), true)['name'];
} catch (ConflictException $ex) {
$name = sprintf(
'projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s' ,
$this->projectId,
$this->location,
$keyRingId,
$cryptoKeyId
);
}
$policy = [
'policy' => [
'bindings' => [
[
'role' => 'roles/cloudkms.cryptoKeyEncrypterDecrypter',
'members' => [
"serviceAccount:" . $this->serviceAccountEmail
]
]
]
]
];
$uri = 'https://cloudkms.googleapis.com/v1/projects/%s/locations/' .
'%s/keyRings/%s/cryptoKeys/%s:setIamPolicy';
$this->requestWrapper->send(
new Request(
'POST',
sprintf(
$uri,
$this->projectId,
$this->location,
$keyRingId,
$cryptoKeyId
),
[],
json_encode($policy)
)
);
return $name;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/System/SystemTestCase.php
================================================
process();
}
/**
* Create a random integer ID for test entities.
*
* @return int
*
* @experimental
* @internal
*/
public static function randId()
{
return rand(1, 9999999);
}
/**
* Create a bucket and enqueue it for deletion.
*
* This method provides a means of creating a bucket with pre-configured
* flush+delete functionality. Use in place of `StorageClient::createBucket()`.
*
* When inserting objects into a bucket created with this method, you do NOT need
* to enqueue those objects for deletion or concern yourself with order of
* operations.
*
* @param StorageClient $client
* @param string $bucketName
* @param array $options
* @return Bucket
* @throws GoogleException
*
* @experimental
* @internal
*/
public static function createBucket(StorageClient $client, $bucketName, array $options = [])
{
$backoff = new ExponentialBackoff(8, function ($ex) {
return !($ex instanceof BadRequestException);
});
$bucket = $backoff->execute(function () use ($client, $bucketName, $options) {
return $client->createBucket($bucketName, $options);
});
self::$deletionQueue->add(function () use ($bucket) {
foreach ($bucket->objects() as $object) {
$object->delete();
}
$bucket->delete();
});
return $bucket;
}
/**
* Create a dataset and enqueue it for deletion.
*
* This method provides a means of creating a dataset with pre-configured
* flush+delete functionality. Use in place of `BigQueryClient::createDataset()`.
*
* When inserting tables into a dataset created with this method, you do NOT need
* to enqueue those tables for deletion or concern yourself with order of
* operations.
*
* @param BigQueryClient $client
* @param string $datasetName
* @param array $options
* @return Dataset
*
* @experimental
* @internal
*/
public static function createDataset(BigQueryClient $client, $datasetName, array $options = [])
{
$dataset = $client->createDataset($datasetName, $options);
self::$deletionQueue->add(function () use ($dataset) {
$dataset->delete(['deleteContents' => true]);
});
return $dataset;
}
/**
* Create a topic and enqueue it for deletion.
*
* This method provides a means of creating a topic with pre-configured
* flush+delete functionality. Use in place of `PubSubClient::createTopic()`.
*
* When inserting subscriptions into a topic created with this method, you do NOT need
* to enqueue those subscriptions for deletion or concern yourself with order of
* operations.
*
* @param PubSubClient $client
* @param string $topicName
* @param array $options
* @return Topic
* @throws GoogleException
*
* @experimental
* @internal
*/
public static function createTopic(PubSubClient $client, $topicName, array $options = [])
{
$backoff = new ExponentialBackoff(8);
$topic = $backoff->execute(function () use ($client, $topicName, $options) {
return $client->createTopic($topicName, $options);
});
self::$deletionQueue->add(function () use ($topic) {
foreach ($topic->subscriptions() as $subscription) {
$subscription->delete();
}
$topic->delete();
});
return $topic;
}
/**
* Set "using emulator" flag for single test case.
*
* Should be called in `setUpBeforeClass()` method. This will allow to
* skip tests that are not supported by emulator.
*
* Example:
* ```
* self::setUsingEmulator(getenv('FOOBAR_EMULATOR_HOST'));
* ```
*
* @param bool $enabled Whether emulator is detected. **Defaults to** `true`.
*/
public static function setUsingEmulator($enabled = true)
{
self::$emulatedClasses[get_called_class()] = (bool)$enabled;
}
/**
* Set "using emulator" flag for test cases with specified fully-qualified name prefix.
*
* Should be called in `setUpBeforeClass()` method. This will allow to
* skip tests that are not supported by emulator.
*
* Example:
* ```
* // Set flag for called class namespace.
* self::setUsingEmulatorForClassPrefix(getenv('FOOBAR_EMULATOR_HOST'));
* ```
*
* ```
* // Set flag for some other namespace.
* self::setUsingEmulatorForClassPrefix(getenv('FOOBAR_EMULATOR_HOST'), 'Foobar\\Tests\\System\\Admin\\');
* ```
*
* @param bool $enabled Whether emulator is detected. **Defaults to** `true`.
* @param string|null $prefix Fully-qualified class name prefix. **Defaults to** called class namespace.
*/
public static function setUsingEmulatorForClassPrefix($enabled = true, $prefix = null)
{
if (!isset($prefix)) {
$className = get_called_class();
$prefix = substr($className, 0, strrpos($className, '\\') + 1);
}
self::$emulatedClassPrefixes[$prefix] = (bool)$enabled;
}
/**
* Returns `true` when "using emulator" flag is set either for called class name or its
* fully-qualified name prefix or `false` otherwise.
*
* Example:
* ```
* $transports = [['grpc']];
* if (!self::isEmulatorUsed()) {
* $transports[] = ['rest'];
* }
* ```
*
* @return bool
*/
public static function isEmulatorUsed()
{
$className = get_called_class();
if (!isset(self::$emulatedClasses[$className])) {
$prefix = substr($className, 0, strrpos($className, '\\') + 1);
$isEmulated = false;
foreach (self::$emulatedClassPrefixes as $key => $flag) {
if (strpos($prefix, $key) === 0) {
$isEmulated = $flag;
break;
}
}
self::$emulatedClasses[$className] = $isEmulated;
}
return self::$emulatedClasses[$className];
}
/**
* Skips current test (when called from test method) or entire test case (when called from `setUpBeforeClass()`)
* if "using emulator" flag is set either for called class name or its fully-qualified name prefix.
*
* Example:
* ```
* // Use default reason.
* self::skipIfEmulatorUsed();
* ```
*
* ```
* // Use custom reason.
* self::skipIfEmulatorUsed('Administration functions are not supported by emulator.');
* ```
*
* @param string|null $reason Message explaining reason for skipping this test.
*/
public static function skipIfEmulatorUsed($reason = null)
{
if (self::isEmulatorUsed()) {
self::markTestSkipped($reason ?: 'This test is not supported by the emulator.');
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Testing/TestHelpers.php
================================================
newInstanceArgs(array_values($args));
}
/**
* Get a trait implementation.
*
* @param string $trait The fully-qualified name of the trait to implement.
* @return mixed
*
* @experimental
* @internal
*/
public static function impl($trait, array $props = [])
{
$properties = [];
foreach ($props as $prop) {
$properties[] = 'private $' . $prop . ';';
}
$tpl = 'class %s {
use %s;
use \Google\Cloud\Core\Testing\StubTrait;
private $___props = \'%s\';
%s
public function call($fn, array $args = []) { return call_user_func_array([$this, $fn], $args); }
}';
$name = 'Trait' . sha1($trait . json_encode($props));
if (!class_exists($name)) {
eval(sprintf($tpl, $name, $trait, json_encode($props), implode("\n", $properties)));
}
return new $name;
}
/**
* Setup snippet tests support.
*
* @return void
* @experimental
* @internal
*/
public static function snippetBootstrap()
{
putenv('GOOGLE_APPLICATION_CREDENTIALS='. Fixtures::KEYFILE_STUB_FIXTURE());
$parser = new Parser;
$scanner = new Scanner($parser, self::projectRoot(), [
'/vendor/',
'/dev/',
new RegexFileFilter('/\w{0,}\/vendor\//'),
new RegexFileFilter('/\w{0,}\/V\d{1,}\w{0,}\//'),
'LongRunning/', // LongRunning doesn't match the GAPIC regex, but should still be excluded
]);
$coverage = new Coverage($scanner);
$coverage->buildListToCover();
Container::$coverage = $coverage;
Container::$parser = $parser;
}
/**
* Setup performance tests support.
*
* @return void
* @experimental
* @internal
*/
public static function perfBootstrap()
{
$bootstraps = glob(self::projectRoot() .'/*tests/Perf/bootstrap.php');
foreach ($bootstraps as $bootstrap) {
require_once $bootstrap;
}
}
/**
* Check that the required environment variable keyfile paths are set and exist.
*
* @param array|string $env The environment variable(s) required.
* @throws \RuntimeException
* @experimental
* @internal
*/
public static function requireKeyfile($env)
{
$env = is_array($env) ? $env : [$env];
foreach ($env as $var) {
if (!getenv($var)) {
throw new \RuntimeException(sprintf(
'Please set the \'%s\' env var to run the tests',
$var
));
}
$path = getenv($var);
if (!file_exists($path)) {
throw new \RuntimeException(sprintf(
'The path \`%s\` specified in environment variable `%s` does not exist.',
$path,
$var
));
}
}
}
/**
* Setup stuff needed for the system test runner.
*
* This method can only be called once per run. Subsequent calls will thrown \RuntimeException.
*
* @internal
* @experimental
*/
public static function systemBootstrap()
{
static $started = false;
if ($started) {
throw new \RuntimeException('system tests cannot be bootstrapped more than once.');
}
SystemTestCase::setupQueue();
// also set up the generated system tests
self::generatedSystemTestBootstrap();
$bootstraps = glob(self::projectRoot() .'/*tests/System/bootstrap.php');
foreach ($bootstraps as $bootstrap) {
require_once $bootstrap;
}
// This should always be last.
self::systemTestShutdown(function () {
SystemTestCase::processQueue();
});
$started = true;
}
/**
* Setup stuff needed for the generated system tests.
* @internal
* @experimental
*/
public static function generatedSystemTestBootstrap()
{
// For generated system tests, we need to set GOOGLE_APPLICATION_CREDENTIALS
// and PROJECT_ID to appropriate values
$keyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH');
if (empty($keyFilePath)) {
exit('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH must be set to run system tests.');
}
putenv("GOOGLE_APPLICATION_CREDENTIALS=$keyFilePath");
$keyFileData = json_decode(file_get_contents($keyFilePath), true);
putenv('PROJECT_ID=' . $keyFileData['project_id']);
putenv('GOOGLE_PROJECT_ID=' . $keyFileData['project_id']);
}
/**
* Add cleanup function for system tests.
*
* Calls to this method enqueue a PHP shutdown function, scoped to the parent
* PID.
*
* @param callable $shutdown The shutdown function.
* @return void
* @experimental
* @internal
*/
public static function systemTestShutdown(callable $shutdown)
{
$pid = getmypid();
register_shutdown_function(function () use ($pid, $shutdown) {
// Skip flushing deletion queue if exiting a forked process.
if ($pid !== getmypid()) {
return;
}
$shutdown();
});
}
/**
* Get the value of a private property.
*
* @param mixed $class The class
* @param string $property The property name.
* @return mixed
*/
public static function getPrivateProperty($class, $property)
{
$className = get_class($class);
$c = \Closure::bind(function ($class) use ($property) {
return $class->$property;
}, null, $className);
return $c($class);
}
/**
* Determine the path of the project root based on where the composer
* autoloader is located.
*
* @return string
* @experimental
* @internal
*/
private static function projectRoot()
{
static $projectRoot;
if (!$projectRoot) {
$ref = new \ReflectionClass(\Composer\Autoload\ClassLoader::class);
$projectRoot = dirname(dirname(dirname($ref->getFileName())));
}
return $projectRoot;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/TimeTrait.php
================================================
6) {
$timestamp = str_replace('.' . $subSeconds, '.' . substr($subSeconds, 0, 6), $timestamp);
}
$dt = new \DateTimeImmutable($timestamp);
$nanos = $this->convertFractionToNanoSeconds($subSeconds);
return [$dt, $nanos];
}
/**
* Create a DateTimeImmutable instance from a UNIX timestamp (i.e. seconds since epoch).
*
* @param int $seconds The unix timestamp.
* @return \DateTimeImmutable
*/
private function createDateTimeFromSeconds($seconds)
{
return \DateTimeImmutable::createFromFormat(
'U',
(string) $seconds,
new \DateTimeZone('UTC')
);
}
/**
* Create a Timestamp string in an API-compatible format.
*
* @param \DateTimeInterface $dateTime The date time object.
* @param int|null $ns The number of nanoseconds. If null, subseconds from
* $dateTime will be used instead.
* @return string
*/
private function formatTimeAsString(\DateTimeInterface $dateTime, $ns)
{
if (!$dateTime instanceof \DateTimeImmutable) {
$dateTime = clone $dateTime;
}
$dateTime = $dateTime->setTimeZone(new \DateTimeZone('UTC'));
if ($ns === null) {
return $dateTime->format(Timestamp::FORMAT);
}
return sprintf(
$dateTime->format(Timestamp::FORMAT_INTERPOLATE),
$this->convertNanoSecondsToFraction($ns)
);
}
/**
* Format a timestamp for the API with nanosecond precision.
*
* @param \DateTimeInterface $dateTime The date time object.
* @param int|null $ns The number of nanoseconds. If null, subseconds from
* $dateTime will be used instead.
* @return array
*/
private function formatTimeAsArray(\DateTimeInterface $dateTime, $ns = null)
{
if ($ns === null) {
$ns = $this->convertFractionToNanoSeconds($dateTime->format('u'));
}
return [
'seconds' => (int) $dateTime->format('U'),
'nanos' => (int) $ns
];
}
/**
* Convert subseconds, expressed as a decimal to nanoseconds.
*
* @param int|string $subseconds Provide value as a whole number (i.e.
* provide 0.1 as 1).
* @return int
*/
private function convertFractionToNanoSeconds($subseconds)
{
return (int) str_pad($subseconds, 9, '0', STR_PAD_RIGHT);
}
/**
* Convert nanoseconds to subseconds.
*
* Note that result should be used as a fraction of one second, but is
* given as an integer.
*
* @param int|string $nanos
* @param bool $rpad Whether to right-pad to 6 or 9 digits. **Defaults to**
* `true`.
* @return string
*/
private function convertNanoSecondsToFraction($nanos, $rpad = true)
{
$nanos = (string) $nanos;
$res = str_pad($nanos, 9, '0', STR_PAD_LEFT);
if (substr($res, 6, 3) === '000') {
$res = substr($res, 0, 6);
}
if (!$rpad) {
$res = rtrim($res, '0');
}
return $res;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Timestamp.php
================================================
value = $value;
$this->nanoSeconds = $nanoSeconds !== null
? (int) $nanoSeconds
: null;
}
/**
* Get the underlying `\DateTimeInterface` implementation.
*
* Please note that if you provided nanoseconds when creating the timestamp,
* they will not be included in this value.
*
* Example:
* ```
* $dateTime = $timestamp->get();
* ```
*
* @return DateTimeInterface
*/
public function get(): DateTimeInterface
{
return $this->value;
}
/**
* Return the number of nanoseconds.
*
* Example:
* ```
* $nanos = $timestamp->nanoSeconds();
* ```
*
* @return int
*/
public function nanoSeconds(): int
{
return $this->nanoSeconds === null
? (int) $this->value->format('u') * 1000
: $this->nanoSeconds;
}
/**
* Format the value as a string.
*
* Example:
* ```
* $value = $timestamp->formatAsString();
* ```
*
* @return string
*/
public function formatAsString(): string
{
return $this->formatTimeAsString(
$this->value,
$this->nanoSeconds
);
}
/**
* Format the value as a string.
*
* @return string
* @access private
*/
public function __toString()
{
return $this->formatAsString();
}
/**
* Format a timestamp for the API with nanosecond precision.
*
* @return array
*/
public function formatForApi(): array
{
return $this->formatTimeAsArray($this->value, $this->nanoSeconds());
}
/**
* Implement JsonSerializable by returning a ISO 8601 formatted string
*
* @return string
* @access private
*/
#[\ReturnTypeWillChange]
public function jsonSerialize(): string
{
return $this->formatAsString();
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/TimestampTrait.php
================================================
formatForApi();
}
return $args;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Upload/AbstractUploader.php
================================================
requestWrapper = $requestWrapper;
$this->data = Utils::streamFor($data);
$this->uri = $uri;
$this->metadata = $options['metadata'] ?? [];
$this->chunkSize = $options['chunkSize'] ?? null;
$this->requestOptions = array_intersect_key($options, [
'restOptions' => null,
'retries' => null,
'requestTimeout' => null,
'restRetryFunction' => null,
'restRetryListener' => null
]);
$this->contentType = $options['contentType'] ?? 'application/octet-stream';
}
/**
* @return array
*/
abstract public function upload();
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Upload/MultipartUploader.php
================================================
jsonDecode(
$this->requestWrapper->send(
$this->prepareRequest(),
$this->requestOptions
)->getBody(),
true
);
}
/**
* Triggers the upload process asynchronously.
*
* @return PromiseInterface
* @experimental The experimental flag means that while we believe this method
* or class is ready for use, it may change before release in backwards-
* incompatible ways. Please use with caution, and test thoroughly when
* upgrading.
*/
public function uploadAsync()
{
return $this->requestWrapper->sendAsync(
$this->prepareRequest(),
$this->requestOptions
)->then(function (ResponseInterface $response) {
return $this->jsonDecode(
$response->getBody(),
true
);
});
}
/**
* Prepares a multipart upload request.
*
* @return RequestInterface
*/
private function prepareRequest()
{
$multipartStream = new Psr7\MultipartStream([
[
'name' => 'metadata',
'headers' => ['Content-Type' => 'application/json; charset=UTF-8'],
'contents' => $this->jsonEncode($this->metadata)
],
[
'name' => 'data',
'headers' => ['Content-Type' => $this->contentType],
'contents' => $this->data
]
], 'boundary');
$headers = [
'Content-Type' => 'multipart/related; boundary=boundary',
];
$size = $multipartStream->getSize();
if ($size !== null) {
$headers['Content-Length'] = $size;
}
return new Request(
'POST',
$this->uri,
$headers,
$multipartStream
);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Upload/ResumableUploader.php
================================================
uploadProgressCallback = $options['uploadProgressCallback'];
} elseif (isset($options['uploadProgressCallback'])) {
throw new \InvalidArgumentException('$options.uploadProgressCallback must be a callable.');
}
}
/**
* Gets the resume URI.
*
* @return string
*/
public function getResumeUri()
{
if (!$this->resumeUri) {
return $this->createResumeUri();
}
return $this->resumeUri;
}
/**
* Resumes a download using the provided URI.
*
* @param string $resumeUri
* @return array
* @throws GoogleException
*/
public function resume($resumeUri)
{
if (!$this->data->isSeekable()) {
throw new GoogleException('Cannot resume upload on a stream which cannot be seeked.');
}
$this->resumeUri = $resumeUri;
$response = $this->getStatusResponse();
if ($response->getBody()->getSize() > 0) {
return $this->decodeResponse($response);
}
$this->rangeStart = $this->getRangeStart($response->getHeaderLine('Range'));
return $this->upload();
}
/**
* Triggers the upload process.
*
* Errors are of form [`google.rpc.Status`](https://cloud.google.com/apis/design/errors#error_model),
* and may be obtained via {@see \Google\Cloud\Core\Exception\ServiceException::getMetadata()}.
*
* @return array
* @throws ServiceException
*/
public function upload()
{
$rangeStart = $this->rangeStart;
$response = null;
$resumeUri = $this->getResumeUri();
$size = $this->data->getSize() ?: '*';
do {
$data = new LimitStream(
$this->data,
$this->chunkSize ?: - 1,
$rangeStart
);
$currStreamLimitSize = $data->getSize();
$rangeEnd = $rangeStart + ($currStreamLimitSize - 1);
$headers = $this->headers + [
'Content-Length' => $currStreamLimitSize,
'Content-Type' => $this->contentType,
'Content-Range' => "bytes $rangeStart-$rangeEnd/$size",
];
$request = new Request(
'PUT',
$resumeUri,
$headers,
$data
);
try {
$response = $this->requestWrapper->send($request, $this->requestOptions);
} catch (GoogleException $ex) {
throw new ServiceException(
"Upload failed. Please use this URI to resume your upload: $this->resumeUri",
$ex->getCode(),
null,
json_decode($ex->getMessage(), true) ?: []
);
}
if (is_callable($this->uploadProgressCallback)) {
call_user_func($this->uploadProgressCallback, $currStreamLimitSize);
}
$rangeStart = $this->getRangeStart($response->getHeaderLine('Range'));
} while ($response->getStatusCode() === 308);
return $this->decodeResponse($response);
}
/**
* Currently only the MultiPartUploader supports async.
*
* Any calls to this will throw a generic Google Exception.
*
* @return PromiseInterface
* @throws GoogleException
* @experimental The experimental flag means that while we believe this method
* or class is ready for use, it may change before release in backwards-
* incompatible ways. Please use with caution, and test thoroughly when
* upgrading.
*/
public function uploadAsync()
{
throw new GoogleException('Currently only the MultiPartUploader supports async.');
}
/**
* Fetch and decode the response body
*
* @param ResponseInterface $response
* @return array
*/
protected function decodeResponse(ResponseInterface $response)
{
return $this->jsonDecode($response->getBody(), true);
}
/**
* Creates the resume URI.
*
* @return string
*/
protected function createResumeUri()
{
$headers = $this->headers + [
'X-Upload-Content-Type' => $this->contentType,
'X-Upload-Content-Length' => $this->data->getSize(),
'Content-Type' => 'application/json'
];
$body = $this->jsonEncode($this->metadata);
$request = new Request(
'POST',
$this->uri,
$headers,
$body
);
$response = $this->requestWrapper->send($request, $this->requestOptions);
return $this->resumeUri = $response->getHeaderLine('Location');
}
/**
* Gets the status of the upload.
*
* @return ResponseInterface
*/
protected function getStatusResponse()
{
$request = new Request(
'PUT',
$this->resumeUri,
['Content-Range' => 'bytes */' . $this->data->getSize()]
);
return $this->requestWrapper->send($request, $this->requestOptions);
}
/**
* Gets the starting range for the upload.
*
* @param string $rangeHeader
* @return int
*/
protected function getRangeStart($rangeHeader)
{
if (!$rangeHeader) {
// assume no bytes are uploaded if no range header is present
return 0;
}
return (int) explode('-', $rangeHeader)[1] + 1;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Upload/SignedUrlUploader.php
================================================
headers['Origin'] = $options['origin'];
unset($options['origin']);
}
parent::__construct($requestWrapper, $data, $uri, $options);
}
/**
* Creates the resume URI.
*
* @return string
*/
protected function createResumeUri()
{
$headers = $this->headers + [
'Content-Type' => $this->contentType,
'Content-Length' => 0,
'x-goog-resumable' => 'start'
];
$request = new Request(
'POST',
$this->uri,
$headers
);
$response = $this->requestWrapper->send($request, $this->requestOptions);
return $this->resumeUri = $response->getHeaderLine('Location');
}
/**
* Decode the response body
*
* @param ResponseInterface $response
* @return string
*/
protected function decodeResponse(ResponseInterface $response)
{
return $response->getBody();
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/Upload/StreamableUploader.php
================================================
getResumeUri();
if ($writeSize) {
$rangeEnd = $this->rangeStart + $writeSize - 1;
$data = $this->data->read($writeSize);
} else {
$rangeEnd = '*';
$data = $this->data->getContents();
$writeSize = strlen($data);
}
// do the streaming write
$headers = [
'Content-Length' => $writeSize,
'Content-Type' => $this->contentType,
'Content-Range' => "bytes {$this->rangeStart}-$rangeEnd/*"
];
$request = new Request(
'PUT',
$resumeUri,
$headers,
$data
);
try {
$response = $this->requestWrapper->send($request, $this->requestOptions);
} catch (ServiceException $ex) {
throw new GoogleException(
"Upload failed. Please use this URI to resume your upload: $resumeUri",
$ex->getCode(),
$ex
);
}
// reset the buffer with the remaining contents
$this->rangeStart += $writeSize;
return json_decode($response->getBody(), true);
}
/**
* Currently only the MultiPartUploader supports async.
*
* Any calls to this will throw a generic Google Exception.
*
* @return PromiseInterface
* @throws GoogleException
* @experimental The experimental flag means that while we believe this method
* or class is ready for use, it may change before release in backwards-
* incompatible ways. Please use with caution, and test thoroughly when
* upgrading.
*/
public function uploadAsync()
{
throw new GoogleException('Currently only the MultiPartUploader supports async.');
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/UriTrait.php
================================================
expand($uri, $variables);
}
/**
* @param string $uri
* @param array $query
* @return UriInterface
*/
public function buildUriWithQuery($uri, array $query)
{
$query = array_filter($query, function ($v) {
return $v !== null;
});
// @todo fix this hack. when using build_query booleans are converted to
// 1 or 0 which the API does not accept. this casts bools to their
// string representation
foreach ($query as $k => &$v) {
if (is_bool($v)) {
$v = $v ? 'true' : 'false';
}
}
return Utils::uriFor($uri)->withQuery(Query::build($query));
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/ValidateTrait.php
================================================
0,
'nanos' => 0
];
$dt = $this->createDateTimeFromSeconds($timestamp['seconds']);
$nanos = $timestamp['nanos'];
} else {
list($dt, $nanos) = $this->parseTimeString($timestamp);
}
return new $returnType($dt, $nanos);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/src/WhitelistTrait.php
================================================
setMessage('NOTE: Error may be due to Whitelist Restriction. ' . $e->getMessage());
return $e;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-core/system-bootstrap.php
================================================
register(new MessageAwareArrayComparator());
\SebastianBergmann\Comparator\Factory::getInstance()->register(new ProtobufMessageComparator());
\SebastianBergmann\Comparator\Factory::getInstance()->register(new ProtobufGPBEmptyComparator());
// Make sure that while testing we bypass the `final` keyword for the GAPIC client.
// Only run this if the individual component has the helper package installed
if (class_exists(BypassFinals::class)) {
BypassFinals::enable();
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/.gitattributes
================================================
/*.xml.dist export-ignore
/tests export-ignore
/.github export-ignore
================================================
FILE: lib/Google/vendor/google/cloud-storage/CODE_OF_CONDUCT.md
================================================
# Contributor Code of Conduct
As contributors and maintainers of this project,
and in the interest of fostering an open and welcoming community,
we pledge to respect all people who contribute through reporting issues,
posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.
We are committed to making participation in this project
a harassment-free experience for everyone,
regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information,
such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct.
By adopting this Code of Conduct,
project maintainers commit themselves to fairly and consistently
applying these principles to every aspect of managing this project.
Project maintainers who do not follow or enforce the Code of Conduct
may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior
may be reported by opening an issue
or contacting one or more of the project maintainers.
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
================================================
FILE: lib/Google/vendor/google/cloud-storage/CONTRIBUTING.md
================================================
# How to Contribute
We'd love to accept your patches and contributions to this project. We accept
and review pull requests against the main
[Google Cloud PHP](https://github.com/googleapis/google-cloud-php)
repository, which contains all of our client libraries. You will also need to
sign a Contributor License Agreement. For more details about how to contribute,
see the
[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md)
file in the main Google Cloud PHP repository.
================================================
FILE: lib/Google/vendor/google/cloud-storage/LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: lib/Google/vendor/google/cloud-storage/README.md
================================================
# Google Cloud Storage for PHP
> Idiomatic PHP client for [Cloud Storage](https://cloud.google.com/storage/).
[](https://packagist.org/packages/google/cloud-storage) [](https://packagist.org/packages/google/cloud-storage)
* [API documentation](https://cloud.google.com/php/docs/reference/cloud-storage/latest)
**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any
support requests, bug reports, or development contributions should be directed to
that project.
Allows world-wide storage and retrieval of any amount of data at any time. You can use Cloud Storage for a range of
scenarios including serving website content, storing data for archival and disaster recovery, or distributing large data objects to users via direct download.
### Installation
To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/).
Now install this component:
```sh
$ composer require google/cloud-storage
```
### Authentication
Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information
on authenticating your client. Once authenticated, you'll be ready to start making requests.
### Sample
```php
require 'vendor/autoload.php';
use Google\Cloud\Storage\StorageClient;
$storage = new StorageClient();
$bucket = $storage->bucket('my_bucket');
// Upload a file to the bucket.
$bucket->upload(
fopen('/data/file.txt', 'r')
);
// Using Predefined ACLs to manage object permissions, you may
// upload a file and give read access to anyone with the URL.
$bucket->upload(
fopen('/data/file.txt', 'r'),
[
'predefinedAcl' => 'publicRead'
]
);
// Download and store an object from the bucket locally.
$object = $bucket->object('file_backup.txt');
$object->downloadToFile('/data/file_backup.txt');
```
### Stream Wrapper
```php
require 'vendor/autoload.php';
use Google\Cloud\Storage\StorageClient;
$storage = new StorageClient();
$storage->registerStreamWrapper();
$contents = file_get_contents('gs://my_bucket/file_backup.txt');
```
### Debugging
Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)
for more information about the debugging tools.
### Version
This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in
any minor or patch releases. We will address issues and requests with the highest priority.
### Next Steps
1. Understand the [official documentation](https://cloud.google.com/storage/docs).
2. Take a look at [in-depth usage samples](https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/storage/).
================================================
FILE: lib/Google/vendor/google/cloud-storage/SECURITY.md
================================================
# Security Policy
To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
================================================
FILE: lib/Google/vendor/google/cloud-storage/VERSION
================================================
1.49.0
================================================
FILE: lib/Google/vendor/google/cloud-storage/composer.json
================================================
{
"name": "google/cloud-storage",
"description": "Cloud Storage Client for PHP",
"license": "Apache-2.0",
"minimum-stability": "stable",
"require": {
"php": "^8.1",
"google/cloud-core": "^1.57",
"ramsey/uuid": "^4.2.3"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
"phpspec/prophecy-phpunit": "^2.0",
"squizlabs/php_codesniffer": "2.*",
"phpdocumentor/reflection": "^5.3.3||^6.0",
"phpdocumentor/reflection-docblock": "^5.3",
"erusev/parsedown": "^1.6",
"phpseclib/phpseclib": "^2.0||^3.0",
"google/cloud-pubsub": "^2.0"
},
"suggest": {
"phpseclib/phpseclib": "May be used in place of OpenSSL for creating signed Cloud Storage URLs. Please require version ^2.",
"google/cloud-pubsub": "May be used to register a topic to receive bucket notifications."
},
"extra": {
"component": {
"id": "cloud-storage",
"target": "googleapis/google-cloud-php-storage.git",
"path": "Storage",
"entry": "src/StorageClient.php"
}
},
"autoload": {
"psr-4": {
"Google\\Cloud\\Storage\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Google\\Cloud\\Storage\\Tests\\": "tests"
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/Acl.php
================================================
bucket('my-bucket');
* $acl = $bucket->acl();
* ```
*/
class Acl
{
const ROLE_READER = 'READER';
const ROLE_WRITER = 'WRITER';
const ROLE_OWNER = 'OWNER';
/**
* @var ConnectionInterface Represents a connection to Cloud Storage.
* @internal
*/
protected $connection;
/**
* @var array ACL specific options.
*/
private $aclOptions;
/**
* @param ConnectionInterface $connection Represents a connection to
* Cloud Storage. This object is created by StorageClient,
* and should not be instantiated outside of this client.
* @param string $type The type of access control this instance applies to.
* @param array $identity Represents which bucket, file, or generation this
* instance applies to.
* @throws \InvalidArgumentException Thrown when an invalid type is passed in.
*/
public function __construct(ConnectionInterface $connection, $type, array $identity)
{
$validTypes = [
'bucketAccessControls',
'defaultObjectAccessControls',
'objectAccessControls'
];
if (!in_array($type, $validTypes)) {
throw new InvalidArgumentException('type must be one of the following: ' . implode(', ', $validTypes));
}
$this->connection = $connection;
$this->aclOptions = $identity + ['type' => $type];
}
/**
* Delete access controls.
*
* Delete access controls on a {@see Bucket} or
* {@see StorageObject} for a specified entity.
*
* Example:
* ```
* $acl->delete('allAuthenticatedUsers');
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/delete BucketAccessControls delete
* API documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls/delete
* DefaultObjectAccessControls delete API documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/delete ObjectAccessControls delete
* API documentation.
*
* @param string $entity The entity to delete.
* @param array $options [optional] Configuration Options.
* @return void
*/
public function delete($entity, array $options = [])
{
$aclOptions = $this->aclOptions + ['entity' => $entity];
$this->connection->deleteAcl($options + $aclOptions);
}
/**
* Get access controls.
*
* Get access controls on a {@see Bucket} or
* {@see StorageObject}. By default this will return all available
* access controls. You may optionally specify a single entity to return
* details for as well.
*
* Example:
* ```
* $res = $acl->get(['entity' => 'allAuthenticatedUsers']);
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/get BucketAccessControls get API
* documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls/get
* DefaultObjectAccessControls get API documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/get ObjectAccessControls get API
* documentation.
*
* @param array $options [optional] {
* Configuration options.
*
* @type string $entity The entity to fetch.
* }
* @return array
*/
public function get(array $options = [])
{
if (isset($options['entity'])) {
return $this->connection->getAcl($options + $this->aclOptions);
}
$response = $this->connection->listAcl($options + $this->aclOptions);
return $response['items'];
}
/**
* Add access controls.
*
* Add access controls on a {@see Bucket} or
* {@see StorageObject}.
*
* Example:
* ```
* $acl->add('allAuthenticatedUsers', 'WRITER');
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/insert BucketAccessControls insert
* API documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls/insert
* DefaultObjectAccessControls insert API documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert ObjectAccessControls insert
* API documentation.
*
* @param string $entity The entity to add access controls to.
* @param string $role The permissions to add for the specified entity. May
* be one of 'OWNER', 'READER', or 'WRITER'.
* @param array $options [optional] Configuration Options.
* @return array
*/
public function add($entity, $role, array $options = [])
{
$aclOptions = $this->aclOptions + [
'entity' => $entity,
'role' => $role
];
return $this->connection->insertAcl($options + $aclOptions);
}
/**
* Update access controls.
*
* Update access controls on a {@see Bucket} or {@see StorageObject}.
*
* Example:
* ```
* $acl->update('allAuthenticatedUsers', 'READER');
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/patch BucketAccessControls patch API
* documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls/patch
* DefaultObjectAccessControls patch API documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/patch ObjectAccessControls patch
* API documentation.
*
* @param string $entity The entity to update access controls for.
* @param string $role The permissions to update for the specified entity.
* May be one of 'OWNER', 'READER', or 'WRITER'.
* @param array $options [optional] Configuration Options.
* @return array
*/
public function update($entity, $role, array $options = [])
{
$aclOptions = $this->aclOptions + [
'entity' => $entity,
'role' => $role
];
return $this->connection->patchAcl($options + $aclOptions);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/Bucket.php
================================================
bucket('my-bucket');
* ```
*/
class Bucket
{
use ArrayTrait;
use EncryptionTrait;
const NOTIFICATION_TEMPLATE = '//pubsub.googleapis.com/%s';
const TOPIC_TEMPLATE = 'projects/%s/topics/%s';
const TOPIC_REGEX = '/projects\/[^\/]*\/topics\/(.*)/';
/**
* @var Acl ACL for the bucket.
*/
private $acl;
/**
* @var ConnectionInterface Represents a connection to Cloud Storage.
* @internal
*/
private $connection;
/**
* @var Acl Default ACL for objects created within the bucket.
*/
private $defaultAcl;
/**
* @var array The bucket's identity.
*/
private $identity;
/**
* @var string The project ID.
*/
private $projectId;
/**
* @var array|null The bucket's metadata.
*/
private $info;
/**
* @var Iam|null
*/
private $iam;
/**
* @param ConnectionInterface $connection Represents a connection to Cloud
* Storage. This object is created by StorageClient,
* and should not be instantiated outside of this client.
* @param string $name The bucket's name.
* @param array $info [optional] The bucket's metadata.
*/
public function __construct(ConnectionInterface $connection, $name, array $info = [])
{
$this->connection = $connection;
$this->identity = [
'bucket' => $name,
'userProject' => $this->pluck('requesterProjectId', $info, false)
];
$this->info = $info;
$this->projectId = $this->connection->projectId();
$this->acl = new Acl($this->connection, 'bucketAccessControls', $this->identity);
$this->defaultAcl = new Acl($this->connection, 'defaultObjectAccessControls', $this->identity);
}
/**
* Configure ACL for this bucket.
*
* Example:
* ```
* $acl = $bucket->acl();
* ```
*
* @see https://cloud.google.com/storage/docs/access-control More about Access Control Lists
*
* @return Acl An ACL instance configured to handle the bucket's access
* control policies.
*/
public function acl()
{
return $this->acl;
}
/**
* Configure default object ACL for this bucket.
*
* Example:
* ```
* $acl = $bucket->defaultAcl();
* ```
*
* @see https://cloud.google.com/storage/docs/access-control More about Access Control Lists
* @return Acl An ACL instance configured to handle the bucket's default
* object access control policies.
*/
public function defaultAcl()
{
return $this->defaultAcl;
}
/**
* Check whether or not the bucket exists.
*
* Example:
* ```
* if ($bucket->exists()) {
* echo 'Bucket exists!';
* }
* ```
*
* @param array $options [optional] {
* Configuration options.
* }
* @return bool
*/
public function exists(array $options = [])
{
try {
$this->connection->getBucket($options + $this->identity + ['fields' => 'name']);
} catch (NotFoundException $ex) {
return false;
}
return true;
}
/**
* Upload your data in a simple fashion. Uploads will default to being
* resumable if the file size is greater than 5mb.
*
* Example:
* ```
* $object = $bucket->upload(
* fopen(__DIR__ . '/image.jpg', 'r')
* );
* ```
*
* ```
* // Upload an object in a resumable fashion while setting a new name for
* // the object and including the content language.
* $options = [
* 'resumable' => true,
* 'name' => '/images/new-name.jpg',
* 'metadata' => [
* 'contentLanguage' => 'en'
* ]
* ];
*
* $object = $bucket->upload(
* fopen(__DIR__ . '/image.jpg', 'r'),
* $options
* );
* ```
*
* ```
* // Upload an object with a customer-supplied encryption key.
* $key = base64_encode(openssl_random_pseudo_bytes(32)); // Make sure to remember your key.
*
* $object = $bucket->upload(
* fopen(__DIR__ . '/image.jpg', 'r'),
* ['encryptionKey' => $key]
* );
* ```
*
* ```
* // Upload an object utilizing an encryption key managed by the Cloud Key Management Service (KMS).
* $object = $bucket->upload(
* fopen(__DIR__ . '/image.jpg', 'r'),
* [
* 'metadata' => [
* 'kmsKeyName' => 'projects/my-project/locations/kr-location/keyRings/my-kr/cryptoKeys/my-key'
* ]
* ]
* );
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable Learn more about resumable
* uploads.
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/insert Objects insert API documentation.
* @see https://cloud.google.com/storage/docs/encryption#customer-supplied Customer-supplied encryption keys.
* @see https://github.com/google/php-crc32 crc32c PHP extension for hardware-accelerated validation hashes.
*
* @param string|resource|StreamInterface|null $data The data to be uploaded.
* @param array $options [optional] {
* Configuration options.
*
* @type string $name The name of the destination. Required when data is
* of type string or null.
* @type bool $resumable Indicates whether or not the upload will be
* performed in a resumable fashion.
* @type bool|string $validate Indicates whether or not validation will
* be applied using md5 or crc32c hashing functionality. If
* enabled, and the calculated hash does not match that of the
* upstream server, the upload will be rejected. Available options
* are `true`, `false`, `md5` and `crc32`. If true, either md5 or
* crc32c will be chosen based on your platform. If false, no
* validation hash will be sent. Choose either `md5` or `crc32` to
* force a hash method regardless of performance implications.
* **Defaults to** `true`.
* @type int $chunkSize If provided the upload will be done in chunks.
* The size must be in multiples of 262144 bytes. With chunking
* you have increased reliability at the risk of higher overhead.
* It is recommended to not use chunking.
* @type callable $uploadProgressCallback If provided together with
* $resumable == true the given callable function/method will be
* called after each successfully uploaded chunk. The callable
* function/method will receive the number of uploaded bytes
* after each uploaded chunk as a parameter to this callable.
* It's useful if you want to create a progress bar when using
* resumable upload type together with $chunkSize parameter.
* If $chunkSize is not set the callable function/method will be
* called only once after the successful file upload.
* @type string $predefinedAcl Predefined ACL to apply to the object.
* Acceptable values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type array $retention The full list of available options are outlined
* at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body).
* @type string $retention.retainUntilTime The earliest time in RFC 3339
* UTC "Zulu" format that the object can be deleted or replaced.
* This is the retention configuration set for this object.
* @type string $retention.mode The mode of the retention configuration,
* which can be either `"Unlocked"` or `"Locked"`.
* @type array $metadata The full list of available options are outlined
* at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body).
* @type array $metadata.metadata User-provided metadata, in key/value pairs.
* @type string $encryptionKey A base64 encoded AES-256 customer-supplied
* encryption key. If you would prefer to manage encryption
* utilizing the Cloud Key Management Service (KMS) please use the
* `$metadata.kmsKeyName` setting. Please note if using KMS the
* key ring must use the same location as the bucket.
* @type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
* customer-supplied encryption key. This value will be calculated
* from the `encryptionKey` on your behalf if not provided, but
* for best performance it is recommended to pass in a cached
* version of the already calculated SHA.
* }
* @return StorageObject
* @throws \InvalidArgumentException
*/
public function upload($data, array $options = [])
{
if ($this->isObjectNameRequired($data) && !isset($options['name'])) {
throw new \InvalidArgumentException('A name is required when data is of type string or null.');
}
$encryptionKey = $options['encryptionKey'] ?? null;
$encryptionKeySHA256 = $options['encryptionKeySHA256'] ?? null;
$response = $this->connection->insertObject(
$this->formatEncryptionHeaders($options) + $this->identity + [
'data' => $data
]
)->upload();
return new StorageObject(
$this->connection,
$response['name'],
$this->identity['bucket'],
$response['generation'],
$response,
$encryptionKey,
$encryptionKeySHA256
);
}
/**
* Asynchronously uploads an object.
*
* Please note this method does not support resumable or streaming uploads.
*
* Example:
* ```
* $promise = $bucket->uploadAsync('Lorem Ipsum', ['name' => 'keyToData']);
* $object = $promise->wait();
* ```
*
* ```
* // Upload multiple objects to a bucket asynchronously.
* $promises = [];
* $objects = ['key1' => 'Lorem', 'key2' => 'Ipsum', 'key3' => 'Gypsum'];
*
* foreach ($objects as $k => $v) {
* $promises[] = $bucket->uploadAsync($v, ['name' => $k])
* ->then(function (StorageObject $object) {
* echo $object->name() . PHP_EOL;
* }, function(\Exception $e) {
* throw new Exception('An error has occurred in the matrix.', null, $e);
* });
* }
*
* foreach ($promises as $promise) {
* $promise->wait();
* }
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/insert Objects insert API documentation.
* @see https://cloud.google.com/storage/docs/encryption#customer-supplied Customer-supplied encryption keys.
* @see https://github.com/google/php-crc32 crc32c PHP extension for hardware-accelerated validation hashes.
* @see https://github.com/guzzle/promises Learn more about Guzzle Promises
*
* @param string|resource|StreamInterface|null $data The data to be uploaded.
* @param array $options [optional] {
* Configuration options.
*
* @type string $name The name of the destination. Required when data is
* of type string or null.
* @type bool|string $validate Indicates whether or not validation will
* be applied using md5 or crc32c hashing functionality. If
* enabled, and the calculated hash does not match that of the
* upstream server, the upload will be rejected. Available options
* are `true`, `false`, `md5` and `crc32`. If true, either md5 or
* crc32c will be chosen based on your platform. If false, no
* validation hash will be sent. Choose either `md5` or `crc32` to
* force a hash method regardless of performance implications.
* **Defaults to** `true`.
* @type string $predefinedAcl Predefined ACL to apply to the object.
* Acceptable values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type array $metadata The full list of available options are outlined
* at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body).
* @type array $metadata.metadata User-provided metadata, in key/value pairs.
* @type string $encryptionKey A base64 encoded AES-256 customer-supplied
* encryption key. If you would prefer to manage encryption
* utilizing the Cloud Key Management Service (KMS) please use the
* `$metadata.kmsKeyName` setting. Please note if using KMS the
* key ring must use the same location as the bucket.
* @type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
* customer-supplied encryption key. This value will be calculated
* from the `encryptionKey` on your behalf if not provided, but
* for best performance it is recommended to pass in a cached
* version of the already calculated SHA.
* }
* @return PromiseInterface
* @throws \InvalidArgumentException
* @experimental The experimental flag means that while we believe this method
* or class is ready for use, it may change before release in backwards-
* incompatible ways. Please use with caution, and test thoroughly when
* upgrading.
*/
public function uploadAsync($data, array $options = [])
{
if ($this->isObjectNameRequired($data) && !isset($options['name'])) {
throw new \InvalidArgumentException('A name is required when data is of type string or null.');
}
$encryptionKey = $options['encryptionKey'] ?? null;
$encryptionKeySHA256 = $options['encryptionKeySHA256'] ?? null;
$promise = $this->connection->insertObject(
$this->formatEncryptionHeaders($options) +
$this->identity +
[
'data' => $data,
'resumable' => false
]
)->uploadAsync();
return $promise->then(
function (array $response) use ($encryptionKey, $encryptionKeySHA256) {
return new StorageObject(
$this->connection,
$response['name'],
$this->identity['bucket'],
$response['generation'],
$response,
$encryptionKey,
$encryptionKeySHA256
);
}
);
}
/**
* Get a resumable uploader which can provide greater control over the
* upload process. This is recommended when dealing with large files where
* reliability is key.
*
* Example:
* ```
* $uploader = $bucket->getResumableUploader(
* fopen(__DIR__ . '/image.jpg', 'r')
* );
*
* try {
* $object = $uploader->upload();
* } catch (GoogleException $ex) {
* $resumeUri = $uploader->getResumeUri();
* $object = $uploader->resume($resumeUri);
* }
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable Learn more about resumable
* uploads.
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/insert Objects insert API documentation.
*
* @param string|resource|StreamInterface|null $data The data to be uploaded.
* @param array $options [optional] {
* Configuration options.
*
* @type string $name The name of the destination. Required when data is
* of type string or null.
* @type bool $validate Indicates whether or not validation will be
* applied using md5 hashing functionality. If true and the
* calculated hash does not match that of the upstream server the
* upload will be rejected.
* @type string $predefinedAcl Predefined ACL to apply to the object.
* Acceptable values include `"authenticatedRead`",
* `"bucketOwnerFullControl`", `"bucketOwnerRead`", `"private`",
* `"projectPrivate`", and `"publicRead"`.
* @type array $metadata The available options for metadata are outlined
* at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body).
* @type string $encryptionKey A base64 encoded AES-256 customer-supplied
* encryption key. If you would prefer to manage encryption
* utilizing the Cloud Key Management Service (KMS) please use the
* $metadata['kmsKeyName'] setting. Please note if using KMS the
* key ring must use the same location as the bucket.
* @type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
* customer-supplied encryption key. This value will be calculated
* from the `encryptionKey` on your behalf if not provided, but
* for best performance it is recommended to pass in a cached
* version of the already calculated SHA.
* @type callable $uploadProgressCallback The given callable
* function/method will be called after each successfully uploaded
* chunk. The callable function/method will receive the number of
* uploaded bytes after each uploaded chunk as a parameter to this
* callable. It's useful if you want to create a progress bar when
* using resumable upload type together with $chunkSize parameter.
* If $chunkSize is not set the callable function/method will be
* called only once after the successful file upload.
* }
* @return ResumableUploader
* @throws \InvalidArgumentException
*/
public function getResumableUploader($data, array $options = [])
{
if ($this->isObjectNameRequired($data) && !isset($options['name'])) {
throw new \InvalidArgumentException('A name is required when data is of type string or null.');
}
return $this->connection->insertObject(
$this->formatEncryptionHeaders($options) + $this->identity + [
'data' => $data,
'resumable' => true
]
);
}
/**
* Get a streamable uploader which can provide greater control over the
* upload process. This is useful for generating large files and uploading
* the contents in chunks.
*
* Example:
* ```
* $uploader = $bucket->getStreamableUploader(
* 'initial contents',
* ['name' => 'data.txt']
* );
*
* // finish uploading the item
* $uploader->upload();
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable Learn more about resumable
* uploads.
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/insert Objects insert API documentation.
*
* @param string|resource|StreamInterface $data The data to be uploaded.
* @param array $options [optional] {
* Configuration options.
*
* @type string $name The name of the destination. Required when data is
* of type string or null.
* @type bool $validate Indicates whether or not validation will be
* applied using md5 hashing functionality. If true and the
* calculated hash does not match that of the upstream server the
* upload will be rejected.
* @type int $chunkSize If provided the upload will be done in chunks.
* The size must be in multiples of 262144 bytes. With chunking
* you have increased reliability at the risk of higher overhead.
* It is recommended to not use chunking.
* @type string $predefinedAcl Predefined ACL to apply to the object.
* Acceptable values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type array $metadata The available options for metadata are outlined
* at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body).
* @type string $encryptionKey A base64 encoded AES-256 customer-supplied
* encryption key. If you would prefer to manage encryption
* utilizing the Cloud Key Management Service (KMS) please use the
* $metadata['kmsKeyName'] setting. Please note if using KMS the
* key ring must use the same location as the bucket.
* @type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
* customer-supplied encryption key. This value will be calculated
* from the `encryptionKey` on your behalf if not provided, but
* for best performance it is recommended to pass in a cached
* version of the already calculated SHA.
* }
* @return StreamableUploader
* @throws \InvalidArgumentException
*/
public function getStreamableUploader($data, array $options = [])
{
if ($this->isObjectNameRequired($data) && !isset($options['name'])) {
throw new \InvalidArgumentException('A name is required when data is of type string or null.');
}
return $this->connection->insertObject(
$this->formatEncryptionHeaders($options) + $this->identity + [
'data' => $data,
'streamable' => true,
'validate' => false
]
);
}
/**
* Lazily instantiates an object. There are no network requests made at this
* point.
*
* To see the operations that can be performed on an object please
* see {@see StorageObject}.
*
* Example:
* ```
* $object = $bucket->object('file.txt');
* ```
*
* @param string $name The name of the object to request.
* @param array $options [optional] {
* Configuration options.
*
* @type string $generation Request a specific revision of the object.
* @type string $encryptionKey A base64 encoded AES-256 customer-supplied
* encryption key. It will be neccesary to provide this when a key
* was used during the object's creation.
* @type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
* customer-supplied encryption key. This value will be calculated
* from the `encryptionKey` on your behalf if not provided, but
* for best performance it is recommended to pass in a cached
* version of the already calculated SHA.
* @type boolean $softDeleted If true, returns the metadata of the
* soft-deleted object. If true, generation must also be specified,
* and alt=media cannot be specified.
* }
* @return StorageObject
*/
public function object($name, array $options = [])
{
$generation = $options['generation'] ?? null;
$encryptionKey = $options['encryptionKey'] ?? null;
$encryptionKeySHA256 = $options['encryptionKeySHA256'] ?? null;
return new StorageObject(
$this->connection,
$name,
$this->identity['bucket'],
$generation,
array_filter([
'requesterProjectId' => $this->identity['userProject']
]),
$encryptionKey,
$encryptionKeySHA256
);
}
/**
* Restores an object.
*
* Example:
* ```
* $object = $bucket->restore('file.txt');
* ```
*
* @param string $name The name of the object to restore.
* @param string $generation Request a specific generation of the object.
* @param array $options [optional] {
* Configuration Options.
*
* @type string $restoreToken Must be specified when getting a soft-deleted object from
* an HNS-enabled bucket that has a name and generation conflict with another object in the same bucket.
* @type string $ifGenerationMatch Makes the operation conditional on whether
* the object's current generation matches the given value.
* @type string $ifGenerationNotMatch Makes the operation conditional on whether
* the object's current generation matches the given value.
* @type string $ifMetagenerationMatch If set, only restores
* if its metageneration matches this value.
* @type string $ifMetagenerationNotMatch If set, only restores
* if its metageneration does not match this value.
* }
* @return StorageObject
*/
public function restore($name, $generation, array $options = [])
{
$res = $this->connection->restoreObject([
'bucket' => $this->identity['bucket'],
'generation' => $generation,
'object' => $name,
] + $options);
return new StorageObject(
$this->connection,
$name,
$this->identity['bucket'],
$res['generation'], // restored object will have a new generation
$res + array_filter([
'requesterProjectId' => $this->identity['userProject']
])
);
}
/**
* Fetches all objects in the bucket.
*
* Example:
* ```
* // Get all objects beginning with the prefix 'photo'
* $objects = $bucket->objects([
* 'prefix' => 'photo',
* 'fields' => 'items/name,nextPageToken'
* ]);
*
* foreach ($objects as $object) {
* echo $object->name() . PHP_EOL;
* }
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/list Objects list API documentation.
*
* @param array $options [optional] {
* Configuration options.
*
* @type string $delimiter Returns results in a directory-like mode.
* Results will contain only objects whose names, aside from the
* prefix, do not contain delimiter. Objects whose names, aside
* from the prefix, contain delimiter will have their name,
* truncated after the delimiter, returned in prefixes. Duplicate
* prefixes are omitted.
* @type bool $includeFoldersAsPrefixes If true, will also include folders
* and managed folders (besides objects) in the returned prefixes.
* Only applicable if delimiter is set to '/'.
* @type int $maxResults Maximum number of results to return per
* request. **Defaults to** `1000`.
* @type int $resultLimit Limit the number of results returned in total.
* **Defaults to** `0` (return all results).
* @type string $pageToken A previously-returned page token used to
* resume the loading of results from a specific point.
* @type string $prefix Filter results with this prefix.
* @type string $projection Determines which properties to return. May
* be either `"full"` or `"noAcl"`.
* @type bool $versions If true, lists all versions of an object as
* distinct results. **Defaults to** `false`.
* @type string $fields Selector which will cause the response to only
* return the specified fields.
* @type string $matchGlob A glob pattern to filter results. The string
* value must be UTF-8 encoded. See:
* https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-object-glob
* }
* @return ObjectIterator
*/
public function objects(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ObjectIterator(
new ObjectPageIterator(
function (array $object) {
return new StorageObject(
$this->connection,
$object['name'],
$this->identity['bucket'],
isset($object['generation']) ? $object['generation'] : null,
$object + array_filter([
'requesterProjectId' => $this->identity['userProject']
])
);
},
[$this->connection, 'listObjects'],
$options + $this->identity,
['resultLimit' => $resultLimit]
)
);
}
/**
* Create a Cloud PubSub notification.
*
* Please note, the desired topic must be given the IAM role of
* "pubsub.publisher" from the service account associated with the project
* which contains the bucket you would like to receive notifications from.
* Please see the example below for a programmatic example of achieving
* this.
*
* Example:
* ```
* // Update the permissions on the desired topic prior to creating the
* // notification.
* use Google\Cloud\Core\Iam\PolicyBuilder;
* use Google\Cloud\PubSub\PubSubClient;
*
* $pubSub = new PubSubClient();
* $topicName = 'my-topic';
* $serviceAccountEmail = $storage->getServiceAccount();
* $topic = $pubSub->topic($topicName);
* $iam = $topic->iam();
* $updatedPolicy = (new PolicyBuilder($iam->policy()))
* ->addBinding('roles/pubsub.publisher', [
* "serviceAccount:$serviceAccountEmail"
* ])
* ->result();
* $iam->setPolicy($updatedPolicy);
*
* $notification = $bucket->createNotification($topicName);
* ```
*
* ```
* // Use a fully qualified topic name.
* $notification = $bucket->createNotification('projects/my-project/topics/my-topic');
* ```
*
* ```
* // Provide a Topic object from the Cloud PubSub component.
* use Google\Cloud\PubSub\PubSubClient;
*
* $pubSub = new PubSubClient();
* $topic = $pubSub->topic('my-topic');
* $notification = $bucket->createNotification($topic);
* ```
*
* ```
* // Supplying event types to trigger the notifications.
* $notification = $bucket->createNotification('my-topic', [
* 'event_types' => [
* 'OBJECT_DELETE',
* 'OBJECT_METADATA_UPDATE'
* ]
* ]);
* ```
*
* @codingStandardsIgnoreStart
* @see https://cloud.google.com/storage/docs/pubsub-notifications Cloud PubSub Notifications.
* @see https://cloud.google.com/storage/docs/json_api/v1/notifications/insert Notifications insert API documentation.
* @see https://cloud.google.com/storage/docs/reporting-changes Registering Object Changes.
* @codingStandardsIgnoreEnd
*
* @param string|Topic $topic The topic used to publish notifications.
* @param array $options [optional] {
* Configuration options.
*
* @type array $custom_attributes An optional list of additional
* attributes to attach to each Cloud PubSub message published for
* this notification subscription.
* @type array $event_types If present, only send notifications about
* listed event types. If empty, sent notifications for all event
* types. Acceptablue values include `"OBJECT_FINALIZE"`,
* `"OBJECT_METADATA_UPDATE"`, `"OBJECT_DELETE"`
* , `"OBJECT_ARCHIVE"`.
* @type string $object_name_prefix If present, only apply this
* notification configuration to object names that begin with this
* prefix.
* @type string $payload_format The desired content of the Payload.
* Acceptable values include `"JSON_API_V1"`, `"NONE"`.
* **Defaults to** `"JSON_API_V1"`.
* }
* @return Notification
* @throws \InvalidArgumentException When providing a type other than string
* or {@see \Google\Cloud\PubSub\Topic} as $topic.
* @throws GoogleException When a project ID has not been detected.
* @experimental The experimental flag means that while we believe this
* method or class is ready for use, it may change before release in
* backwards-incompatible ways. Please use with caution, and test
* thoroughly when upgrading.
*/
public function createNotification($topic, array $options = [])
{
$res = $this->connection->insertNotification($options + $this->identity + [
'topic' => $this->getFormattedTopic($topic),
'payload_format' => 'JSON_API_V1'
]);
return new Notification(
$this->connection,
$res['id'],
$this->identity['bucket'],
$res + [
'requesterProjectId' => $this->identity['userProject']
]
);
}
/**
* Lazily instantiates a notification. There are no network requests made at
* this point.
*
* To see the operations that can be performed on a notification
* please see {@see Notification}.
*
* Example:
* ```
* $notification = $bucket->notification('4582');
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/notifications#resource Notifications API documentation.
*
* @param string $id The ID of the notification to access.
* @return Notification
* @experimental The experimental flag means that while we believe this
* method or class is ready for use, it may change before release in
* backwards-incompatible ways. Please use with caution, and test
* thoroughly when upgrading.
*/
public function notification($id)
{
return new Notification(
$this->connection,
$id,
$this->identity['bucket'],
['requesterProjectId' => $this->identity['userProject']]
);
}
/**
* Fetches all notifications associated with this bucket.
*
* Example:
* ```
* $notifications = $bucket->notifications();
*
* foreach ($notifications as $notification) {
* echo $notification->id() . PHP_EOL;
* }
* ```
*
* @codingStandardsIgnoreStart
* @see https://cloud.google.com/storage/docs/json_api/v1/notifications/list Notifications list API documentation.
* @codingStandardsIgnoreEnd
*
* @param array $options [optional] {
* Configuration options.
*
* @type int $resultLimit Limit the number of results returned in total.
* **Defaults to** `0` (return all results).
* }
* @return ItemIterator
* @experimental The experimental flag means that while we believe this
* method or class is ready for use, it may change before release in
* backwards-incompatible ways. Please use with caution, and test
* thoroughly when upgrading.
*/
public function notifications(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
/** @var ItemIterator */
return new ItemIterator(
new PageIterator(
function (array $notification) {
return new Notification(
$this->connection,
$notification['id'],
$this->identity['bucket'],
$notification + [
'requesterProjectId' => $this->identity['userProject']
]
);
},
[$this->connection, 'listNotifications'],
$options + $this->identity,
['resultLimit' => $resultLimit]
)
);
}
/**
* Delete the bucket.
*
* Example:
* ```
* $bucket->delete();
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/buckets/delete Buckets delete API documentation.
*
* @param array $options [optional] {
* Configuration options.
* @type string $ifMetagenerationMatch If set, only deletes the bucket
* if its metageneration matches this value.
* @type string $ifMetagenerationNotMatch If set, only deletes the
* bucket if its metageneration does not match this value.
* }
* @return void
*/
public function delete(array $options = [])
{
$this->connection->deleteBucket($options + $this->identity);
}
/**
* Update the bucket. Upon receiving a result the local bucket's data will
* be updated.
*
* Example:
* ```
* // Enable logging on an existing bucket.
* $bucket->update([
* 'logging' => [
* 'logBucket' => 'myBucket',
* 'logObjectPrefix' => 'prefix'
* ]
* ]);
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/buckets/patch Buckets patch API documentation.
* @see https://cloud.google.com/storage/docs/key-terms#bucket-labels Bucket Labels
*
* @codingStandardsIgnoreStart
* @param array $options [optional] {
* Configuration options.
*
* @type string $ifMetagenerationMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current
* metageneration matches the given value.
* @type string $ifMetagenerationNotMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current
* metageneration does not match the given value.
* @type string $predefinedAcl Predefined ACL to apply to the bucket.
* Acceptable values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type string $predefinedDefaultObjectAcl Apply a predefined set of
* default object access controls to this bucket. Acceptable
* values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type string $projection Determines which properties to return. May
* be either `"full"` or `"noAcl"`.
* @type string $fields Selector which will cause the response to only
* return the specified fields.
* @type array $acl Access controls on the bucket.
* @type array $cors The bucket's Cross-Origin Resource Sharing (CORS)
* configuration.
* @type array $defaultObjectAcl Default access controls to apply to new
* objects when no ACL is provided.
* @type array|Lifecycle $lifecycle The bucket's lifecycle configuration.
* @type array $logging The bucket's logging configuration, which
* defines the destination bucket and optional name prefix for the
* current bucket's logs.
* @type string $storageClass The bucket's storage class. This defines
* how objects in the bucket are stored and determines the SLA and
* the cost of storage. Acceptable values include the following
* strings: `"STANDARD"`, `"NEARLINE"`, `"COLDLINE"` and
* `"ARCHIVE"`. Legacy values including `"MULTI_REGIONAL"`,
* `"REGIONAL"` and `"DURABLE_REDUCED_AVAILABILITY"` are also
* available, but should be avoided for new implementations. For
* more information, refer to the
* [Storage Classes](https://cloud.google.com/storage/docs/storage-classes)
* documentation. **Defaults to** `"STANDARD"`.
* @type array $autoclass The bucket's autoclass configuration.
* Buckets can have either StorageClass OLM rules or Autoclass,
* but not both. When Autoclass is enabled on a bucket, adding
* StorageClass OLM rules will result in failure.
* For more information, refer to
* [Storage Autoclass](https://cloud.google.com/storage/docs/autoclass)
* @type array $versioning The bucket's versioning configuration.
* @type array $website The bucket's website configuration.
* @type array $billing The bucket's billing configuration.
* @type bool $billing.requesterPays When `true`, requests to this bucket
* and objects within it must provide a project ID to which the
* request will be billed.
* @type array $labels The Bucket labels. Labels are represented as an
* array of keys and values. To remove an existing label, set its
* value to `null`.
* @type array $encryption Encryption configuration used by default for
* newly inserted objects.
* @type string $encryption.defaultKmsKeyName A Cloud KMS Key used to
* encrypt objects uploaded into this bucket. Should be in the
* format
* `projects/my-project/locations/kr-location/keyRings/my-kr/cryptoKeys/my-key`.
* Please note the KMS key ring must use the same location as the
* bucket.
* @type bool $defaultEventBasedHold When `true`, newly created objects
* in this bucket will be retained indefinitely until an event
* occurs, signified by the hold's release.
* @type array $retentionPolicy Defines the retention policy for a
* bucket. In order to lock a retention policy, please see
* {@see Bucket::lockRetentionPolicy()}.
* @type int $retentionPolicy.retentionPeriod Specifies the duration
* that objects need to be retained, in seconds. Retention
* duration must be greater than zero and less than 100 years.
* @type array $iamConfiguration The bucket's IAM configuration.
* @type bool $iamConfiguration.bucketPolicyOnly.enabled this is an alias
* for $iamConfiguration.uniformBucketLevelAccess.
* @type bool $iamConfiguration.uniformBucketLevelAccess.enabled If set and
* true, access checks only use bucket-level IAM policies or
* above. When enabled, requests attempting to view or manipulate
* ACLs will fail with error code 400. **NOTE**: Before using
* Uniform bucket-level access, please review the
* [feature documentation](https://cloud.google.com/storage/docs/uniform-bucket-level-access),
* as well as
* [Should You Use uniform bucket-level access](https://cloud.google.com/storage/docs/uniform-bucket-level-access#should-you-use)
* @type string $iamConfiguration.publicAccessPrevention The bucket's
* Public Access Prevention configuration. Currently,
* 'inherited' and 'enforced' are supported. **defaults to**
* `inherited`. For more details, see
* [Public Access Prevention](https://cloud.google.com/storage/docs/public-access-prevention).
* }
* @codingStandardsIgnoreEnd
* @return array
*/
public function update(array $options = [])
{
if (isset($options['lifecycle']) && $options['lifecycle'] instanceof Lifecycle) {
$options['lifecycle'] = $options['lifecycle']->toArray();
}
return $this->info = $this->connection->patchBucket($options + $this->identity);
}
/**
* Composes a set of objects into a single object.
*
* Please note that all objects to be composed must come from the same
* bucket.
*
* Example:
* ```
* $sourceObjects = ['log1.txt', 'log2.txt'];
* $singleObject = $bucket->compose($sourceObjects, 'combined-logs.txt');
* ```
*
* ```
* // Use an instance of StorageObject.
* $sourceObjects = [
* $bucket->object('log1.txt'),
* $bucket->object('log2.txt')
* ];
*
* $singleObject = $bucket->compose($sourceObjects, 'combined-logs.txt');
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/compose Objects compose API documentation
*
* @param string[]|StorageObject[] $sourceObjects The objects to compose.
* @param string $name The name of the composed object.
* @param array $options [optional] {
* Configuration options.
*
* @type string $predefinedAcl Predefined ACL to apply to the composed
* object. Acceptable values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type array $metadata Metadata to apply to the composed object. The
* available options for metadata are outlined at the
* [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body).
* @type string $ifGenerationMatch Makes the operation conditional on whether the object's current generation
* matches the given value.
* @type string $ifMetagenerationMatch Makes the operation conditional on whether the object's current
* metageneration matches the given value.
* }
* @return StorageObject
* @throws \InvalidArgumentException
*/
public function compose(array $sourceObjects, $name, array $options = [])
{
if (count($sourceObjects) < 2) {
throw new \InvalidArgumentException('Must provide at least two objects to compose.');
}
$options += [
'destinationBucket' => $this->name(),
'destinationObject' => $name,
'destinationPredefinedAcl' => isset($options['predefinedAcl']) ? $options['predefinedAcl'] : null,
'destination' => isset($options['metadata']) ? $options['metadata'] : null,
'userProject' => $this->identity['userProject'],
'sourceObjects' => array_map(function ($sourceObject) {
$name = null;
$generation = null;
if ($sourceObject instanceof StorageObject) {
$name = $sourceObject->name();
$generation = $sourceObject->identity()['generation'] ?? null;
}
return array_filter([
'name' => $name ?: $sourceObject,
'generation' => $generation
]);
}, $sourceObjects)
];
if (!isset($options['destination']['contentType'])) {
$options['destination']['contentType'] = MimeType::fromFilename($name);
}
if ($options['destination']['contentType'] === null) {
throw new \InvalidArgumentException('A content type could not be detected and must be provided manually.');
}
unset($options['metadata']);
unset($options['predefinedAcl']);
$response = $this->connection->composeObject(array_filter($options));
return new StorageObject(
$this->connection,
$response['name'],
$this->identity['bucket'],
$response['generation'],
$response + array_filter([
'requesterProjectId' => $this->identity['userProject']
])
);
}
/**
* Retrieves the bucket's details. If no bucket data is cached a network
* request will be made to retrieve it.
*
* Example:
* ```
* $info = $bucket->info();
* echo $info['location'];
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/buckets/get Buckets get API documentation.
*
* @param array $options [optional] {
* Configuration options.
*
* @type string $generation If present, selects a specific soft-deleted
* version of this bucket instead of the live version.
* This parameter is required if softDeleted is set to true.
* @type string $ifMetagenerationMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current
* metageneration matches the given value.
* @type string $ifMetagenerationNotMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current
* metageneration does not match the given value.
* @type string $projection Determines which properties to return. May
* be either `"full"` or `"noAcl"`.
* @type bool $softDeleted If true, returns the soft-deleted bucket.
* This parameter is required if generation is specified.
* }
* @return array
*/
public function info(array $options = [])
{
return $this->info ?: $this->reload($options);
}
/**
* Triggers a network request to reload the bucket's details.
*
* Example:
* ```
* $bucket->reload();
* $info = $bucket->info();
* echo $info['location'];
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/buckets/get Buckets get API documentation.
*
* @param array $options [optional] {
* Configuration options.
*
* @type string $generation If present, selects a specific soft-deleted
* version of this bucket instead of the live version.
* This parameter is required if softDeleted is set to true.
* @type string $ifMetagenerationMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current
* metageneration matches the given value.
* @type string $ifMetagenerationNotMatch Makes the return of the bucket
* metadata conditional on whether the bucket's current
* metageneration does not match the given value.
* @type string $projection Determines which properties to return. May
* be either `"full"` or `"noAcl"`.
* @type bool $softDeleted If true, returns the soft-deleted bucket.
* This parameter is required if generation is specified.
* }
* @return array
*/
public function reload(array $options = [])
{
return $this->info = $this->connection->getBucket($options + $this->identity);
}
/**
* Retrieves the bucket's name.
*
* Example:
* ```
* echo $bucket->name();
* ```
*
* @return string
*/
public function name()
{
return $this->identity['bucket'];
}
/**
* Retrieves a fresh lifecycle builder. If a lifecyle configuration already
* exists on the target bucket and this builder is used, it will fully
* replace the configuration with the rules provided by this builder.
*
* This builder is intended to be used in tandem with
* {@see StorageClient::createBucket()} and
* {@see Bucket::update()}.
*
* Example:
* ```
* use Google\Cloud\Storage\Bucket;
*
* $lifecycle = Bucket::lifecycle()
* ->addDeleteRule([
* 'age' => 50,
* 'isLive' => true
* ]);
* $bucket->update([
* 'lifecycle' => $lifecycle
* ]);
* ```
*
* @see https://cloud.google.com/storage/docs/lifecycle Object Lifecycle Management API Documentation
*
* @param array $lifecycle [optional] A lifecycle configuration. Please see
* [here](https://cloud.google.com/storage/docs/json_api/v1/buckets#lifecycle)
* for the expected structure.
* @return Lifecycle
*/
public static function lifecycle(array $lifecycle = [])
{
return new Lifecycle($lifecycle);
}
/**
* Retrieves a lifecycle builder preconfigured with the lifecycle rules that
* already exists on the bucket.
*
* Use this if you want to make updates to an
* existing configuration without removing existing rules, as would be the
* case when using {@see Bucket::lifecycle()}.
*
* This builder is intended to be used in tandem with
* {@see StorageClient::createBucket()} and
* {@see Bucket::update()}.
*
* Please note, this method may trigger a network request in order to fetch
* the existing lifecycle rules from the server.
*
* Example:
* ```
* $lifecycle = $bucket->currentLifecycle()
* ->addDeleteRule([
* 'age' => 50,
* 'isLive' => true
* ]);
* $bucket->update([
* 'lifecycle' => $lifecycle
* ]);
* ```
*
* ```
* // Iterate over existing rules.
* $lifecycle = $bucket->currentLifecycle();
*
* foreach ($lifecycle as $rule) {
* print_r($rule);
* }
* ```
*
* @see https://cloud.google.com/storage/docs/lifecycle Object Lifecycle Management API Documentation
*
* @param array $options [optional] Configuration options.
* @return Lifecycle
*/
public function currentLifecycle(array $options = [])
{
return self::lifecycle(
isset($this->info($options)['lifecycle'])
? $this->info['lifecycle']
: []
);
}
/**
* Returns whether the bucket with the given file prefix is writable.
* Tries to create a temporary file as a resumable upload which will
* not be completed (and cleaned up by GCS).
*
* @param string $file [optional] File to try to write.
* @return bool
* @throws ServiceException
*/
public function isWritable($file = null)
{
$file = $file ?: '__tempfile';
$uploader = $this->getResumableUploader(
Utils::streamFor(''),
['name' => $file]
);
try {
$uploader->getResumeUri();
} catch (ServiceException $e) {
// We expect a 403 access denied error if the bucket is not writable
if ($e->getCode() == 403) {
return false;
}
// If not a 403, re-raise the unexpected error
throw $e;
}
return true;
}
/**
* Manage the IAM policy for the current Bucket.
*
* To request a policy with conditions, pass an array with
* '[requestedPolicyVersion => 3]' as argument to the policy() and
* reload() methods.
*
* Example:
* ```
* $iam = $bucket->iam();
*
* // Returns the stored policy, or fetches the policy if none exists.
* $policy = $iam->policy(['requestedPolicyVersion' => 3]);
*
* // Fetches a policy from the server.
* $policy = $iam->reload(['requestedPolicyVersion' => 3]);
* ```
*
* @codingStandardsIgnoreStart
* @see https://cloud.google.com/storage/docs/access-control/iam-with-json-and-xml Storage Access Control Documentation
* @see https://cloud.google.com/storage/docs/json_api/v1/buckets/getIamPolicy Get Bucket IAM Policy
* @see https://cloud.google.com/storage/docs/json_api/v1/buckets/setIamPolicy Set Bucket IAM Policy
* @see https://cloud.google.com/storage/docs/json_api/v1/buckets/testIamPermissions Test Bucket Permissions
* @see https://cloud.google.com/iam/docs/policies#versions policy versioning.
* @codingStandardsIgnoreEnd
*
* @return Iam
*/
public function iam()
{
if (!$this->iam) {
$this->iam = new Iam(
new IamBucket($this->connection),
$this->identity['bucket'],
[
'parent' => null,
'args' => $this->identity
]
);
}
return $this->iam;
}
/**
* Locks a provided retention policy on this bucket. Upon receiving a result,
* the local bucket's data will be updated.
*
* Please note that in order for this call to succeed, the applicable
* metageneration value will need to be available. It can either be supplied
* explicitly through the `ifMetagenerationMatch` option or detected for you
* by ensuring a value is cached locally (by calling
* {@see Bucket::reload()} or
* {@see Bucket::info()}, for example).
*
* Example:
* ```
* // Set a retention policy.
* $bucket->update([
* 'retentionPolicy' => [
* 'retentionPeriod' => 604800 // One week in seconds.
* ]
* ]);
* // Lock in the policy.
* $info = $bucket->lockRetentionPolicy();
* $retentionPolicy = $info['retentionPolicy'];
*
* // View the time from which the policy was enforced and effective. (RFC 3339 format)
* echo $retentionPolicy['effectiveTime'] . PHP_EOL;
*
* // View whether or not the retention policy is locked. This will be
* // `true` after a successful call to `lockRetentionPolicy`.
* echo $retentionPolicy['isLocked'];
* ```
*
* @see https://cloud.google.com/storage/docs/bucket-lock Bucket Lock Documentation
*
* @param array $options [optional] {
* Configuration options.
*
* @type string $ifMetagenerationMatch Only locks the retention policy
* if the bucket's metageneration matches this value. If not
* provided the locally cached metageneration value will be used,
* otherwise an exception will be thrown.
* }
* @throws \BadMethodCallException If no metageneration value is available.
* @return array
*/
public function lockRetentionPolicy(array $options = [])
{
if (!isset($options['ifMetagenerationMatch'])) {
if (!isset($this->info['metageneration'])) {
throw new \BadMethodCallException(
'No metageneration value was detected. Please either provide ' .
'a value explicitly or ensure metadata is loaded through a ' .
'call such as Bucket::reload().'
);
}
$options['ifMetagenerationMatch'] = $this->info['metageneration'];
}
return $this->info = $this->connection->lockRetentionPolicy(
$options + $this->identity
);
}
/**
* Create a Signed URL listing objects in this bucket.
*
* Example:
* ```
* $url = $bucket->signedUrl(time() + 3600);
* ```
*
* ```
* // Use V4 Signing
* $url = $bucket->signedUrl(time() + 3600, [
* 'version' => 'v4'
* ]);
* ```
*
* @see https://cloud.google.com/storage/docs/access-control/signed-urls Signed URLs
*
* @param Timestamp|\DateTimeInterface|int $expires Specifies when the URL
* will expire. May provide an instance of {@see \Google\Cloud\Core\Timestamp},
* [http://php.net/datetimeimmutable](`\DateTimeImmutable`), or a
* UNIX timestamp as an integer.
* @param array $options {
* Configuration Options.
*
* @type string $cname The CNAME for the bucket, for instance
* `https://cdn.example.com`. **Defaults to**
* `https://storage.googleapis.com`.
* @type string $contentMd5 The MD5 digest value in base64. If you
* provide this, the client must provide this HTTP header with
* this same value in its request. If provided, take care to
* always provide this value as a base64 encoded string.
* @type string $contentType If you provide this value, the client must
* provide this HTTP header set to the same value.
* @type bool $forceOpenssl If true, OpenSSL will be used regardless of
* whether phpseclib is available. **Defaults to** `false`.
* @type array $headers If additional headers are provided, the server
* will check to make sure that the client provides matching
* values. Provide headers as a key/value array, where the key is
* the header name, and the value is an array of header values.
* Headers with multiple values may provide values as a simple
* array, or a comma-separated string. For a reference of allowed
* headers, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers).
* Header values will be trimmed of leading and trailing spaces,
* multiple spaces within values will be collapsed to a single
* space, and line breaks will be replaced by an empty string.
* V2 Signed URLs may not provide `x-goog-encryption-key` or
* `x-goog-encryption-key-sha256` headers.
* @type FetchAuthTokenInterface $credentialsFetcher A credentials
* fetcher instance.
* @type array $keyFile [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* @type string $keyFilePath [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* @type array $queryParams Additional query parameters to be included
* as part of the signed URL query string. For allowed values,
* see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query).
* @type string $version One of "v2" or "v4". *Defaults to** `"v2"`.
* }
* @return string
* @throws \InvalidArgumentException If the given expiration is invalid or in the past.
* @throws \InvalidArgumentException If the given `$options.method` is not valid.
* @throws \InvalidArgumentException If the given `$options.keyFilePath` is not valid.
* @throws \InvalidArgumentException If the given custom headers are invalid.
* @throws \RuntimeException If the keyfile does not contain the required information.
*/
public function signedUrl($expires, array $options = [])
{
// May be overridden for testing.
$signingHelper = $this->pluck('helper', $options, false)
?: SigningHelper::getHelper();
$resource = sprintf(
'/%s',
$this->identity['bucket']
);
return $signingHelper->sign(
$this->connection,
$expires,
$resource,
null,
$options
);
}
/**
* Create a signed upload policy for uploading objects.
*
* This method generates and signs a policy document. You can use policy
* documents to allow visitors to a website to upload files to Google Cloud
* Storage without giving them direct write access.
*
* Google Cloud PHP does not support v2 post policies.
*
* Example:
* ```
* $policy = $bucket->generateSignedPostPolicyV4($objectName, new \DateTime('tomorrow'), [
* 'conditions' => [
* ['content-length-range', 0, 255]
* ],
* 'fields' => [
* 'x-goog-meta-hello' => 'world',
* 'success_action_redirect' => 'https://google.com'
* ]
* ]);
*
* echo '';
* ```
*
* @see https://cloud.google.com/storage/docs/xml-api/post-object#policydocument Policy Documents
*
* @param string $objectName The path to the file in Google Cloud Storage,
* relative to the bucket.
* @param Timestamp|\DateTimeInterface|int $expires Specifies when the URL
* will expire. May provide an instance of {@see \Google\Cloud\Core\Timestamp},
* [http://php.net/datetimeimmutable](`\DateTimeImmutable`), or a
* UNIX timestamp as an integer.
* @param array $options [optional] {
* Configuration options
*
* @type string $bucketBoundHostname The hostname for the bucket, for
* instance `cdn.example.com`. May be used for Google Cloud Load
* Balancers or for custom bucket CNAMEs. **Defaults to**
* `storage.googleapis.com`.
* @type array $conditions A list of arrays containing policy matching
* conditions (e.g. `eq`, `starts-with`, `content-length-range`).
* @type array $fields Additional form fields (do not include
* `x-goog-signature`, `file`, `policy` or fields with an
* `x-ignore` prefix), given as key/value pairs.
* @type bool $forceOpenssl If true, OpenSSL will be used regardless of
* whether phpseclib is available. **Defaults to** `false`.
* @type FetchAuthTokenInterface $credentialsFetcher A credentials
* fetcher instance.
* @type array $keyFile [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* @type string $keyFilePath [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* hostname is provided via `$options.bucketBoundHostname`. If a
* custom bucketBoundHostname is provided, **defaults to** `http`.
* In all other cases, **defaults to** `https`.
* @type string|array $scopes One or more authentication scopes to be
* used with a key file. This option is ignored unless
* `$options.keyFile` or `$options.keyFilePath` is set.
* @type bool $virtualHostedStyle If `true`, URL will be of form
* `mybucket.storage.googleapis.com`. If `false`,
* `storage.googleapis.com/mybucket`. **Defaults to** `false`.
* }
* @return array An associative array, containing (string) `uri` and
* (array) `fields` keys.
*/
public function generateSignedPostPolicyV4($objectName, $expires, array $options = [])
{
// May be overridden for testing.
$signingHelper = $this->pluck('helper', $options, false)
?: SigningHelper::getHelper();
$resource = sprintf('/%s/%s', $this->identity['bucket'], $objectName);
return $signingHelper->v4PostPolicy(
$this->connection,
$expires,
$resource,
$options
);
}
/**
* Determines if an object name is required.
*
* @param mixed $data
* @return bool
*/
private function isObjectNameRequired($data)
{
return is_string($data) || is_null($data);
}
/**
* Return a topic name in its fully qualified format.
*
* @param Topic|string $topic
* @return string
* @throws \InvalidArgumentException
* @throws GoogleException
*/
private function getFormattedTopic($topic)
{
if ($topic instanceof Topic) {
return sprintf(self::NOTIFICATION_TEMPLATE, $topic->name());
}
if (!is_string($topic)) {
throw new \InvalidArgumentException(
'$topic may only be a string or instance of Google\Cloud\PubSub\Topic'
);
}
if (preg_match('/projects\/[^\/]*\/topics\/(.*)/', $topic) === 1) {
return sprintf(self::NOTIFICATION_TEMPLATE, $topic);
}
if (!$this->projectId) {
throw new GoogleException(
'No project ID was provided, ' .
'and we were unable to detect a default project ID.'
);
}
return sprintf(
self::NOTIFICATION_TEMPLATE,
sprintf(self::TOPIC_TEMPLATE, $this->projectId, $topic)
);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/BucketIterator.php
================================================
*/
public function unreachable()
{
return $this->unreachable->getArrayCopy();
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/Connection/ConnectionInterface.php
================================================
connection = $connection;
}
/**
* @param array $args
*/
public function getPolicy(array $args)
{
if (isset($args['requestedPolicyVersion'])) {
$args['optionsRequestedPolicyVersion'] = $args['requestedPolicyVersion'];
unset($args['requestedPolicyVersion']);
}
return $this->connection->getBucketIamPolicy($args);
}
/**
* @param array $args
*/
public function setPolicy(array $args)
{
unset($args['resource']);
return $this->connection->setBucketIamPolicy($args);
}
/**
* @param array $args
*/
public function testPermissions(array $args)
{
unset($args['resource']);
return $this->connection->testBucketIamPermissions($args);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php
================================================
__DIR__ . '/ServiceDefinition/storage-v1.json',
'componentVersion' => StorageClient::VERSION,
'apiEndpoint' => null,
// If the user has not supplied a universe domain, use the environment variable if set.
// Otherwise, use the default ("googleapis.com").
'universeDomain' => getenv('GOOGLE_CLOUD_UNIVERSE_DOMAIN')
?: GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN,
// Cloud Storage needs to provide a default scope because the Storage
// API does not accept JWTs with "audience"
'scopes' => StorageClient::FULL_CONTROL_SCOPE,
];
$this->apiEndpoint = $this->getApiEndpoint(null, $config, self::DEFAULT_API_ENDPOINT_TEMPLATE);
$this->setRequestWrapper(new RequestWrapper($config));
$this->setRequestBuilder(new RequestBuilder(
$config['serviceDefinitionPath'],
$this->apiEndpoint
));
$this->projectId = $this->pluck('projectId', $config, false);
$this->restRetryFunction = (isset($config['restRetryFunction'])) ? $config['restRetryFunction'] : null;
$this->retryStrategy = $config['retryStrategy'] ?? null;
$this->restDelayFunction = $config['restDelayFunction'] ?? null;
$this->restCalcDelayFunction = $config['restCalcDelayFunction'] ?? null;
$this->restRetryListener = $config['restRetryListener'] ?? null;
}
/**
* @return string
*/
public function projectId()
{
return $this->projectId;
}
/**
* @param array $args
*/
public function deleteAcl(array $args = [])
{
return $this->send($args['type'], 'delete', $args);
}
/**
* @param array $args
*/
public function getAcl(array $args = [])
{
return $this->send($args['type'], 'get', $args);
}
/**
* @param array $args
*/
public function listAcl(array $args = [])
{
return $this->send($args['type'], 'list', $args);
}
/**
* @param array $args
*/
public function insertAcl(array $args = [])
{
return $this->send($args['type'], 'insert', $args);
}
/**
* @param array $args
*/
public function patchAcl(array $args = [])
{
return $this->send($args['type'], 'patch', $args);
}
/**
* @param array $args
*/
public function deleteBucket(array $args = [])
{
return $this->send('buckets', 'delete', $args);
}
/**
* @param array $args
*/
public function restoreBucket(array $args = [])
{
return $this->send('buckets', 'restore', $args);
}
/**
* @param array $args
*/
public function getBucket(array $args = [])
{
return $this->send('buckets', 'get', $args);
}
/**
* @param array $args
*/
public function listBuckets(array $args = [])
{
return $this->send('buckets', 'list', $args);
}
/**
* @param array $args
*/
public function insertBucket(array $args = [])
{
return $this->send('buckets', 'insert', $args);
}
/**
* @param array $args
*/
public function patchBucket(array $args = [])
{
return $this->send('buckets', 'patch', $args);
}
/**
* @param array $args
*/
public function deleteObject(array $args = [])
{
return $this->send('objects', 'delete', $args);
}
/**
* @param array $args
*/
public function restoreObject(array $args = [])
{
return $this->send('objects', 'restore', $args);
}
/**
* @param array $args
*/
public function copyObject(array $args = [])
{
return $this->send('objects', 'copy', $args);
}
/**
* @param array $args
*/
public function rewriteObject(array $args = [])
{
return $this->send('objects', 'rewrite', $args);
}
/**
* @param array $args
*/
public function moveObject(array $args = [])
{
return $this->send('objects', 'move', $args);
}
/**
* @param array $args
*/
public function composeObject(array $args = [])
{
return $this->send('objects', 'compose', $args);
}
/**
* @param array $args
*/
public function getObject(array $args = [])
{
return $this->send('objects', 'get', $args);
}
/**
* @param array $args
*/
public function listObjects(array $args = [])
{
return $this->send('objects', 'list', $args);
}
/**
* @param array $args
*/
public function patchObject(array $args = [])
{
return $this->send('objects', 'patch', $args);
}
/**
* @param array $args
*/
public function downloadObject(array $args = [])
{
// This makes sure we honour the range headers specified by the user
$requestedBytes = $this->getRequestedBytes($args);
$resultStream = Utils::streamFor(null);
$transcodedObj = false;
$args['retryStrategy'] ??= $this->retryStrategy;
list($request, $requestOptions) = $this->buildDownloadObjectParams($args);
$invocationId = Uuid::uuid4()->toString();
$requestOptions['retryHeaders'] = self::getRetryHeaders($invocationId, 1);
$requestOptions['restRetryFunction'] = $this->getRestRetryFunction('objects', 'get', $args);
// We try to deduce if the object is a transcoded object when we receive the headers.
$requestOptions['restOptions']['on_headers'] = function ($response) use (&$transcodedObj) {
$header = $response->getHeader(self::TRANSCODED_OBJ_HEADER_KEY);
if (is_array($header) && in_array(self::TRANSCODED_OBJ_HEADER_VAL, $header)) {
$transcodedObj = true;
}
};
$attempt = null;
$requestOptions['restRetryListener'] = function (
\Exception $e,
$retryAttempt,
&$arguments
) use (
$resultStream,
$requestedBytes,
$invocationId,
&$attempt,
) {
// if the exception has a response for us to use
if ($e instanceof RequestException
&& $e->hasResponse()
&& $e->getResponse()->getStatusCode() >= 200
&& $e->getResponse()->getStatusCode() < 300
) {
$msg = (string) $e->getResponse()->getBody();
$fetchedStream = Utils::streamFor($msg);
// add the partial response to our stream that we will return
Utils::copyToStream($fetchedStream, $resultStream);
// Start from the byte that was last fetched
$startByte = intval($requestedBytes['startByte']) + $resultStream->getSize();
$endByte = $requestedBytes['endByte'];
// modify the range headers to fetch the remaining data
$arguments[1]['headers']['Range'] = sprintf('bytes=%s-%s', $startByte, $endByte);
$arguments[0] = $this->modifyRequestForRetry($arguments[0], $retryAttempt, $invocationId);
// Copy the final result to the end of the stream
$attempt = $retryAttempt;
}
};
$fetchedStream = $this->requestWrapper->send(
$request,
$requestOptions
)->getBody();
// If no retry attempt was made, then we can return the stream as is.
// This is important in the case where downloadObject is called to open
// the file but not to read from it yet.
if ($attempt === null) {
return $fetchedStream;
}
// If our object is a transcoded object, then Range headers are not honoured.
// That means even if we had a partial download available, the final obj
// that was fetched will contain the complete object. So, we don't need to copy
// the partial stream, we can just return the stream we fetched.
if ($transcodedObj) {
return $fetchedStream;
}
Utils::copyToStream($fetchedStream, $resultStream);
$resultStream->seek(0);
return $resultStream;
}
/**
* @param array $args
* @experimental The experimental flag means that while we believe this method
* or class is ready for use, it may change before release in backwards-
* incompatible ways. Please use with caution, and test thoroughly when
* upgrading.
*/
public function downloadObjectAsync(array $args = [])
{
list($request, $requestOptions) = $this->buildDownloadObjectParams($args);
return $this->requestWrapper->sendAsync(
$request,
$requestOptions
)->then(function (ResponseInterface $response) {
return $response->getBody();
});
}
/**
* @param array $args
*/
public function insertObject(array $args = [])
{
$args = $this->resolveUploadOptions($args);
$uploadType = AbstractUploader::UPLOAD_TYPE_RESUMABLE;
if ($args['streamable']) {
$uploaderClass = StreamableUploader::class;
} elseif ($args['resumable']) {
$uploaderClass = ResumableUploader::class;
} else {
$uploaderClass = MultipartUploader::class;
$uploadType = AbstractUploader::UPLOAD_TYPE_MULTIPART;
}
$uriParams = [
'bucket' => $args['bucket'],
'query' => [
'predefinedAcl' => $args['predefinedAcl'],
'uploadType' => $uploadType,
'userProject' => $args['userProject']
]
];
// Passing the preconditions we want to extract out of arguments
// into our query params.
$preconditions = self::$condIdempotentOps['objects.insert'];
foreach ($preconditions as $precondition) {
if (isset($args[$precondition])) {
$uriParams['query'][$precondition] = $args[$precondition];
}
}
return new $uploaderClass(
$this->requestWrapper,
$args['data'],
$this->expandUri($this->apiEndpoint . self::UPLOAD_PATH, $uriParams),
$args['uploaderOptions']
);
}
/**
* @param array $args
*/
private function resolveUploadOptions(array $args)
{
$args += [
'bucket' => null,
'name' => null,
'validate' => true,
'resumable' => null,
'streamable' => null,
'predefinedAcl' => null,
'metadata' => [],
'userProject' => null,
];
$args['retryStrategy'] ??= $this->retryStrategy;
$args['data'] = Utils::streamFor($args['data']);
if ($args['resumable'] === null) {
$args['resumable'] = $args['data']->getSize() > AbstractUploader::RESUMABLE_LIMIT;
}
if (!$args['name']) {
$args['name'] = basename($args['data']->getMetadata('uri'));
}
$validate = $this->chooseValidationMethod($args);
if ($validate === 'md5') {
$args['metadata']['md5Hash'] = base64_encode(Utils::hash($args['data'], 'md5', true));
} elseif ($validate === 'crc32') {
$args['metadata']['crc32c'] = $this->crcFromStream($args['data']);
}
$args['metadata']['name'] = $args['name'];
if (isset($args['retention'])) {
// during object creation retention properties go into metadata
// but not into request body
$args['metadata']['retention'] = $args['retention'];
unset($args['retention']);
}
unset($args['name']);
$args['contentType'] = $args['metadata']['contentType']
?? MimeType::fromFilename($args['metadata']['name']);
$uploaderOptionKeys = [
'restOptions',
'retries',
'requestTimeout',
'chunkSize',
'contentType',
'metadata',
'uploadProgressCallback',
'restDelayFunction',
'restCalcDelayFunction',
];
$args['uploaderOptions'] = array_intersect_key($args, array_flip($uploaderOptionKeys));
$args = array_diff_key($args, array_flip($uploaderOptionKeys));
// Passing on custom retry function to $args['uploaderOptions']
$retryFunc = $this->getRestRetryFunction(
'objects',
'insert',
$args
);
$args['uploaderOptions']['restRetryFunction'] = $retryFunc;
$args['uploaderOptions'] = $this->addRetryHeaderLogic(
$args['uploaderOptions']
);
return $args;
}
/**
* @param array $args
*/
public function getBucketIamPolicy(array $args)
{
return $this->send('buckets', 'getIamPolicy', $args);
}
/**
* @param array $args
*/
public function setBucketIamPolicy(array $args)
{
return $this->send('buckets', 'setIamPolicy', $args);
}
/**
* @param array $args
*/
public function testBucketIamPermissions(array $args)
{
return $this->send('buckets', 'testIamPermissions', $args);
}
/**
* @param array $args
*/
public function getNotification(array $args = [])
{
return $this->send('notifications', 'get', $args);
}
/**
* @param array $args
*/
public function deleteNotification(array $args = [])
{
return $this->send('notifications', 'delete', $args);
}
/**
* @param array $args
*/
public function insertNotification(array $args = [])
{
return $this->send('notifications', 'insert', $args);
}
/**
* @param array $args
*/
public function listNotifications(array $args = [])
{
return $this->send('notifications', 'list', $args);
}
/**
* @param array $args
*/
public function getServiceAccount(array $args = [])
{
return $this->send('projects.resources.serviceAccount', 'get', $args);
}
/**
* @param array $args
*/
public function lockRetentionPolicy(array $args = [])
{
return $this->send('buckets', 'lockRetentionPolicy', $args);
}
/**
* @param array $args
*/
public function createHmacKey(array $args = [])
{
return $this->send('projects.resources.hmacKeys', 'create', $args);
}
/**
* @param array $args
*/
public function deleteHmacKey(array $args = [])
{
return $this->send('projects.resources.hmacKeys', 'delete', $args);
}
/**
* @param array $args
*/
public function getHmacKey(array $args = [])
{
return $this->send('projects.resources.hmacKeys', 'get', $args);
}
/**
* @param array $args
*/
public function updateHmacKey(array $args = [])
{
return $this->send('projects.resources.hmacKeys', 'update', $args);
}
/**
* @param array $args
*/
public function listHmacKeys(array $args = [])
{
return $this->send('projects.resources.hmacKeys', 'list', $args);
}
/**
* @param array $args
* @return array
*/
private function buildDownloadObjectParams(array $args)
{
$args += [
'bucket' => null,
'object' => null,
'generation' => null,
'userProject' => null
];
$requestOptions = array_intersect_key($args, [
'restOptions' => null,
'retries' => null,
'restRetryFunction' => null,
'restCalcDelayFunction' => null,
'restDelayFunction' => null
]);
$queryOptions = [
'generation' => $args['generation'],
'alt' => 'media',
'userProject' => $args['userProject'],
];
if (isset($args['softDeleted'])) {
// alt param cannot be specified with softDeleted param. See:
// https://cloud.google.com/storage/docs/json_api/v1/objects/get
unset($args['alt']);
$queryOptions['softDeleted'] = $args['softDeleted'];
}
$uri = $this->expandUri($this->apiEndpoint . self::DOWNLOAD_PATH, [
'bucket' => $args['bucket'],
'object' => $args['object'],
'query' => $queryOptions,
]);
return [
new Request('GET', Utils::uriFor($uri)),
$requestOptions
];
}
/**
* Choose an upload validation method based on user input and platform
* requirements.
*
* @param array $args
* @return bool|string
*/
private function chooseValidationMethod(array $args)
{
// If the user provided a hash, skip hashing.
if (isset($args['metadata']['md5Hash']) || isset($args['metadata']['crc32c'])) {
return false;
}
$validate = $args['validate'];
if (in_array($validate, [false, 'crc32', 'md5'], true)) {
return $validate;
}
// not documented, but the feature is called crc32c, so let's accept that as input anyways.
if ($validate === 'crc32c') {
return 'crc32';
}
// is the extension loaded?
if ($this->crc32cExtensionLoaded()) {
return 'crc32';
}
// is crc32c available in `hash()`?
if ($this->supportsBuiltinCrc32c()) {
return 'crc32';
}
return 'md5';
}
/**
* Generate a CRC32c checksum from a stream.
*
* @param StreamInterface $data
* @return string
*/
private function crcFromStream(StreamInterface $data)
{
$pos = $data->tell();
$data->rewind();
$crc32c = hash_init('crc32c');
while (!$data->eof()) {
$buffer = $data->read(1048576);
hash_update($crc32c, $buffer);
}
$data->seek($pos);
$hash = hash_final($crc32c, true);
return base64_encode($hash);
}
/**
* Check if the crc32c extension is available.
*
* Protected access for unit testing.
*
* @return bool
*/
protected function crc32cExtensionLoaded()
{
return extension_loaded('crc32c');
}
/**
* Check if hash() supports crc32c.
*
* @return bool
* @deprecated
*/
protected function supportsBuiltinCrc32c()
{
return extension_loaded('hash') && in_array('crc32c', hash_algos());
}
/**
* Add the required retry function and send the request.
*
* @param string $resource resource name, eg: buckets.
* @param string $method method name, eg: get
* @param array $options [optional] Options used to build out the request.
* @param array $whitelisted [optional]
*/
public function send($resource, $method, array $options = [], $whitelisted = false)
{
$retryMap = [
'projects.resources.serviceAccount' => 'serviceaccount',
'projects.resources.hmacKeys' => 'hmacKey',
'bucketAccessControls' => 'bucket_acl',
'defaultObjectAccessControls' => 'default_object_acl',
'objectAccessControls' => 'object_acl'
];
$retryResource = isset($retryMap[$resource]) ? $retryMap[$resource] : $resource;
$options['restRetryFunction'] = $this->restRetryFunction ?? $this->getRestRetryFunction(
$retryResource,
$method,
$options
);
$options += array_filter([
'retryStrategy' => $this->retryStrategy,
'restDelayFunction' => $this->restDelayFunction,
'restCalcDelayFunction' => $this->restCalcDelayFunction,
'restRetryListener' => $this->restRetryListener,
]);
$options = $this->addRetryHeaderLogic($options);
return $this->traitSend($resource, $method, $options);
}
/**
* Adds the retry headers to $args which amends retry hash and attempt
* count to the required header.
* @param array $args
* @return array
*/
private function addRetryHeaderLogic(array $args)
{
$invocationId = Uuid::uuid4()->toString();
$args['retryHeaders'] = self::getRetryHeaders($invocationId, 1);
$userListener = $args['restRetryListener'] ?? null;
// Adding callback logic to update headers while retrying
$args['restRetryListener'] = function (
\Exception $e,
$retryAttempt,
&$arguments
) use (
$invocationId,
$userListener
) {
$arguments[0] = $this->modifyRequestForRetry(
$arguments[0],
$retryAttempt,
$invocationId
);
if ($userListener) {
$userListener($e, $retryAttempt, $arguments);
}
};
return $args;
}
private function modifyRequestForRetry(
RequestInterface $request,
int $retryAttempt,
string $invocationId
) {
$changes = self::getRetryHeaders($invocationId, $retryAttempt + 1);
$headerLine = $request->getHeaderLine(Retry::RETRY_HEADER_KEY);
// An associative array to contain final header values as
// $headerValueKey => $headerValue
$headerElements = [];
// Adding existing values
$headerLineValues = explode(' ', $headerLine);
foreach ($headerLineValues as $value) {
$key = explode('/', $value)[0];
$headerElements[$key] = $value;
}
// Adding changes with replacing value if $key already present
foreach ($changes as $change) {
$key = explode('/', $change)[0];
$headerElements[$key] = $change;
}
return $request->withHeader(
Retry::RETRY_HEADER_KEY,
implode(' ', $headerElements)
);
}
/**
* Util function to compute the bytes requested for a download request.
*
* @param array $options Request options
* @return array
*/
private function getRequestedBytes(array $options)
{
$startByte = 0;
$endByte = '';
if (isset($options['restOptions']) && isset($options['restOptions']['headers'])) {
$headers = $options['restOptions']['headers'];
if (isset($headers['Range']) || isset($headers['range'])) {
$header = isset($headers['Range']) ? $headers['Range'] : $headers['range'];
$range = explode('=', $header);
$bytes = explode('-', $range[1]);
$startByte = $bytes[0];
$endByte = $bytes[1];
}
}
return compact('startByte', 'endByte');
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/Connection/RetryTrait.php
================================================
['ifMetagenerationMatch', 'etag'],
// Currently etag is not supported, so this preCondition never available
'buckets.setIamPolicy' => ['etag'],
'buckets.update' => ['ifMetagenerationMatch', 'etag'],
'hmacKey.update' => ['etag'],
'objects.compose' => ['ifGenerationMatch'],
'objects.copy' => ['ifGenerationMatch'],
'objects.delete' => ['ifGenerationMatch'],
'objects.insert' => ['ifGenerationMatch', 'ifGenerationNotMatch'],
'objects.patch' => ['ifMetagenerationMatch', 'etag'],
'objects.rewrite' => ['ifGenerationMatch'],
'objects.update' => ['ifMetagenerationMatch']
];
/**
* Retry strategies which enforce certain behaviour like:
* - Always retrying a call when an exception occurs(within the limits of 'max retries').
* - Never retrying a call when an exception occurs.
* - Retrying only when the operation is considered idempotent(default).
* These configurations are supplied for per api call basis.
*
*/
/**
* Header that identifies a specific request hash. The
* hash needs to stay the same for multiple retries.
*/
private static $INVOCATION_ID_HEADER = 'gccl-invocation-id';
/**
* Header that identifies the attempt count for a request. The
* value will increment by 1 with every retry.
*/
private static $ATTEMPT_COUNT_HEADER = 'gccl-attempt-count';
/**
* Return a retry decider function.
*
* @param string $resource resource name, eg: buckets.
* @param string $method method name, eg: get
* @param array $args
* @return callable
*/
private function getRestRetryFunction($resource, $method, array $args)
{
if (isset($args['restRetryFunction'])) {
return $args['restRetryFunction'];
}
$methodName = sprintf('%s.%s', $resource, $method);
$isOpIdempotent = in_array($methodName, self::$idempotentOps);
$preconditionNeeded = array_key_exists($methodName, self::$condIdempotentOps);
$preconditionSupplied = $this->isPreConditionSupplied($methodName, $args);
$retryStrategy = isset($args['retryStrategy']) ?
$args['retryStrategy'] :
StorageClient::RETRY_IDEMPOTENT;
return function (
\Exception $exception,
$currentAttempt = 0,
$maxRetries = null
) use (
$isOpIdempotent,
$preconditionNeeded,
$preconditionSupplied,
$retryStrategy
) {
return $this->retryDeciderFunction(
$exception,
$isOpIdempotent,
$preconditionNeeded,
$preconditionSupplied,
$retryStrategy,
$currentAttempt,
$maxRetries
);
};
}
/**
* This function returns true when the user given
* precondtions ($preConditions) has values that are present
* in the precondition map ($this->condIdempotentMap) for that method.
* eg: condIdempotentMap has entry 'objects.copy' => ['ifGenerationMatch'],
* if the user has given 'ifGenerationMatch' in the 'objects.copy' operation,
* it will be available in the $preConditions
* as an array ['ifGenerationMatch']. This makes the array_intersect
* function return a non empty result and this function returns true.
*
* @param string $methodName method name, eg: buckets.get.
* @param array $args arguments which include preconditions provided,
* eg: ['ifGenerationMatch' => 0].
* @return bool
*/
private function isPreConditionSupplied($methodName, array $args)
{
if (isset(self::$condIdempotentOps[$methodName])) {
// return true if required precondition are given.
return !empty(array_intersect(
self::$condIdempotentOps[$methodName],
array_keys($args)
));
}
return false;
}
/**
* Decide whether the op needs to be retried or not.
*
* @param \Exception $exception The exception object received
* while sending the request.
* @param int $currentAttempt Current retry attempt.
* @param bool $isIdempotent
* @param bool $preconditionNeeded
* @param bool $preconditionSupplied
* @param int|null $maxRetries The maximum number of retries allowed.
* Null for no limit.
* @return bool
*/
private function retryDeciderFunction(
\Exception $exception,
$isIdempotent,
$preconditionNeeded,
$preconditionSupplied,
$retryStrategy,
$currentAttempt = 0,
$maxRetries = null
) {
// If maxRetries is specified, ensure we don't exceed it
if ($maxRetries !== null && $currentAttempt >= $maxRetries) {
return false;
}
if ($retryStrategy == StorageClient::RETRY_NEVER) {
return false;
}
$statusCode = $exception->getCode();
// Retry if the exception status code matches
// with one of the retriable status code and
// the operation is either idempotent or conditionally
// idempotent with preconditions supplied.
if (in_array($statusCode, self::$httpRetryCodes)) {
if ($retryStrategy == StorageClient::RETRY_ALWAYS) {
return true;
} elseif ($isIdempotent) {
return true;
} elseif ($preconditionNeeded) {
return $preconditionSupplied;
}
}
return false;
}
/**
* Utility func that returns the list of headers that need to be
* attached to every request and its retries.
*/
private static function getRetryHeaders($invocationId, $attemptCount)
{
return [
sprintf('%s/%s', self::$INVOCATION_ID_HEADER, $invocationId),
sprintf('%s/%d', self::$ATTEMPT_COUNT_HEADER, $attemptCount)
];
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/Connection/ServiceDefinition/storage-v1.json
================================================
{
"kind": "discovery#restDescription",
"version": "v1",
"id": "storage:v1",
"rootUrl": "https://storage.googleapis.com/",
"mtlsRootUrl": "https://storage.mtls.googleapis.com/",
"baseUrl": "https://storage.googleapis.com/storage/v1/",
"basePath": "/storage/v1/",
"servicePath": "storage/v1/",
"batchPath": "batch/storage/v1",
"discoveryVersion": "v1",
"name": "storage",
"title": "Cloud Storage JSON API",
"description": "Stores and retrieves potentially large, immutable data objects.",
"ownerDomain": "google.com",
"ownerName": "Google",
"icons": {
"x16": "https://www.google.com/images/icons/product/cloud_storage-16.png",
"x32": "https://www.google.com/images/icons/product/cloud_storage-32.png"
},
"documentationLink": "https://developers.google.com/storage/docs/json_api/",
"labels": [
"labs"
],
"endpoints": [
{
"endpointUrl": "https://storage.me-central2.rep.googleapis.com/",
"location": "me-central2",
"description": "Regional Endpoint"
}
],
"protocol": "rest",
"parameters": {
"alt": {
"type": "string",
"description": "Data format for the response.",
"default": "json",
"enum": [
"json"
],
"enumDescriptions": [
"Responses with Content-Type of application/json"
],
"location": "query"
},
"fields": {
"type": "string",
"description": "Selector specifying which fields to include in a partial response.",
"location": "query"
},
"key": {
"type": "string",
"description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
"location": "query"
},
"oauth_token": {
"type": "string",
"description": "OAuth 2.0 token for the current user.",
"location": "query"
},
"prettyPrint": {
"type": "boolean",
"description": "Returns response with indentations and line breaks.",
"default": "true",
"location": "query"
},
"quotaUser": {
"type": "string",
"description": "An opaque string that represents a user for quota purposes. Must not exceed 40 characters.",
"location": "query"
},
"userIp": {
"type": "string",
"description": "Deprecated. Please use quotaUser instead.",
"location": "query"
},
"uploadType": {
"type": "string",
"description": "Upload protocol for media (e.g. \"media\", \"multipart\", \"resumable\").",
"location": "query"
}
},
"auth": {
"oauth2": {
"scopes": {
"https://www.googleapis.com/auth/cloud-platform": {
"description": "View and manage your data across Google Cloud Platform services"
},
"https://www.googleapis.com/auth/cloud-platform.read-only": {
"description": "View your data across Google Cloud Platform services"
},
"https://www.googleapis.com/auth/devstorage.full_control": {
"description": "Manage your data and permissions in Google Cloud Storage"
},
"https://www.googleapis.com/auth/devstorage.read_only": {
"description": "View your data in Google Cloud Storage"
},
"https://www.googleapis.com/auth/devstorage.read_write": {
"description": "Manage your data in Google Cloud Storage"
}
}
}
},
"schemas": {
"Bucket": {
"id": "Bucket",
"type": "object",
"description": "A bucket.",
"properties": {
"acl": {
"type": "array",
"description": "Access controls on the bucket.",
"items": {
"$ref": "BucketAccessControl"
},
"annotations": {
"required": [
"storage.buckets.update"
]
}
},
"billing": {
"type": "object",
"description": "The bucket's billing configuration.",
"properties": {
"requesterPays": {
"type": "boolean",
"description": "When set to true, Requester Pays is enabled for this bucket."
}
}
},
"cors": {
"type": "array",
"description": "The bucket's Cross-Origin Resource Sharing (CORS) configuration.",
"items": {
"type": "object",
"properties": {
"maxAgeSeconds": {
"type": "integer",
"description": "The value, in seconds, to return in the Access-Control-Max-Age header used in preflight responses.",
"format": "int32"
},
"method": {
"type": "array",
"description": "The list of HTTP methods on which to include CORS response headers, (GET, OPTIONS, POST, etc) Note: \"*\" is permitted in the list of methods, and means \"any method\".",
"items": {
"type": "string"
}
},
"origin": {
"type": "array",
"description": "The list of Origins eligible to receive CORS response headers. Note: \"*\" is permitted in the list of origins, and means \"any Origin\".",
"items": {
"type": "string"
}
},
"responseHeader": {
"type": "array",
"description": "The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains.",
"items": {
"type": "string"
}
}
}
}
},
"customPlacementConfig": {
"type": "object",
"description": "The bucket's custom placement configuration for Custom Dual Regions.",
"properties": {
"dataLocations": {
"type": "array",
"description": "The list of regional locations in which data is placed.",
"items": {
"type": "string"
}
}
}
},
"defaultEventBasedHold": {
"type": "boolean",
"description": "The default value for event-based hold on newly created objects in this bucket. Event-based hold is a way to retain objects indefinitely until an event occurs, signified by the hold's release. After being released, such objects will be subject to bucket-level retention (if any). One sample use case of this flag is for banks to hold loan documents for at least 3 years after loan is paid in full. Here, bucket-level retention is 3 years and the event is loan being paid in full. In this example, these objects will be held intact for any number of years until the event has occurred (event-based hold on the object is released) and then 3 more years after that. That means retention duration of the objects begins from the moment event-based hold transitioned from true to false. Objects under event-based hold cannot be deleted, overwritten or archived until the hold is removed."
},
"defaultObjectAcl": {
"type": "array",
"description": "Default access controls to apply to new objects when no ACL is provided.",
"items": {
"$ref": "ObjectAccessControl"
}
},
"encryption": {
"type": "object",
"description": "Encryption configuration for a bucket.",
"properties": {
"defaultKmsKeyName": {
"type": "string",
"description": "A Cloud KMS key that will be used to encrypt objects inserted into this bucket, if no encryption method is specified."
}
}
},
"etag": {
"type": "string",
"description": "HTTP 1.1 Entity tag for the bucket."
},
"hierarchicalNamespace": {
"type": "object",
"description": "The bucket's hierarchical namespace configuration.",
"properties": {
"enabled": {
"type": "boolean",
"description": "When set to true, hierarchical namespace is enabled for this bucket."
}
}
},
"iamConfiguration": {
"type": "object",
"description": "The bucket's IAM configuration.",
"properties": {
"bucketPolicyOnly": {
"type": "object",
"description": "The bucket's uniform bucket-level access configuration. The feature was formerly known as Bucket Policy Only. For backward compatibility, this field will be populated with identical information as the uniformBucketLevelAccess field. We recommend using the uniformBucketLevelAccess field to enable and disable the feature.",
"properties": {
"enabled": {
"type": "boolean",
"description": "If set, access is controlled only by bucket-level or above IAM policies."
},
"lockedTime": {
"type": "string",
"description": "The deadline for changing iamConfiguration.bucketPolicyOnly.enabled from true to false in RFC 3339 format. iamConfiguration.bucketPolicyOnly.enabled may be changed from true to false until the locked time, after which the field is immutable.",
"format": "date-time"
}
}
},
"uniformBucketLevelAccess": {
"type": "object",
"description": "The bucket's uniform bucket-level access configuration.",
"properties": {
"enabled": {
"type": "boolean",
"description": "If set, access is controlled only by bucket-level or above IAM policies."
},
"lockedTime": {
"type": "string",
"description": "The deadline for changing iamConfiguration.uniformBucketLevelAccess.enabled from true to false in RFC 3339 format. iamConfiguration.uniformBucketLevelAccess.enabled may be changed from true to false until the locked time, after which the field is immutable.",
"format": "date-time"
}
}
},
"publicAccessPrevention": {
"type": "string",
"description": "The bucket's Public Access Prevention configuration. Currently, 'inherited' and 'enforced' are supported."
}
}
},
"id": {
"type": "string",
"description": "The ID of the bucket. For buckets, the id and name properties are the same."
},
"kind": {
"type": "string",
"description": "The kind of item this is. For buckets, this is always storage#bucket.",
"default": "storage#bucket"
},
"labels": {
"type": "object",
"description": "User-provided labels, in key/value pairs.",
"additionalProperties": {
"type": "string",
"description": "An individual label entry."
}
},
"lifecycle": {
"type": "object",
"description": "The bucket's lifecycle configuration. See lifecycle management for more information.",
"properties": {
"rule": {
"type": "array",
"description": "A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken.",
"items": {
"type": "object",
"properties": {
"action": {
"type": "object",
"description": "The action to take.",
"properties": {
"storageClass": {
"type": "string",
"description": "Target storage class. Required iff the type of the action is SetStorageClass."
},
"type": {
"type": "string",
"description": "Type of the action. Currently, only Delete, SetStorageClass, and AbortIncompleteMultipartUpload are supported."
}
}
},
"condition": {
"type": "object",
"description": "The condition(s) under which the action will be taken.",
"properties": {
"age": {
"type": "integer",
"description": "Age of an object (in days). This condition is satisfied when an object reaches the specified age.",
"format": "int32"
},
"createdBefore": {
"type": "string",
"description": "A date in RFC 3339 format with only the date part (for instance, \"2013-01-15\"). This condition is satisfied when an object is created before midnight of the specified date in UTC.",
"format": "date"
},
"customTimeBefore": {
"type": "string",
"description": "A date in RFC 3339 format with only the date part (for instance, \"2013-01-15\"). This condition is satisfied when the custom time on an object is before this date in UTC.",
"format": "date"
},
"daysSinceCustomTime": {
"type": "integer",
"description": "Number of days elapsed since the user-specified timestamp set on an object. The condition is satisfied if the days elapsed is at least this number. If no custom timestamp is specified on an object, the condition does not apply.",
"format": "int32"
},
"daysSinceNoncurrentTime": {
"type": "integer",
"description": "Number of days elapsed since the noncurrent timestamp of an object. The condition is satisfied if the days elapsed is at least this number. This condition is relevant only for versioned objects. The value of the field must be a nonnegative integer. If it's zero, the object version will become eligible for Lifecycle action as soon as it becomes noncurrent.",
"format": "int32"
},
"isLive": {
"type": "boolean",
"description": "Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects."
},
"matchesPattern": {
"type": "string",
"description": "A regular expression that satisfies the RE2 syntax. This condition is satisfied when the name of the object matches the RE2 pattern. Note: This feature is currently in the \"Early Access\" launch stage and is only available to a whitelisted set of users; that means that this feature may be changed in backward-incompatible ways and that it is not guaranteed to be released."
},
"matchesPrefix": {
"type": "array",
"description": "List of object name prefixes. This condition will be satisfied when at least one of the prefixes exactly matches the beginning of the object name.",
"items": {
"type": "string"
}
},
"matchesSuffix": {
"type": "array",
"description": "List of object name suffixes. This condition will be satisfied when at least one of the suffixes exactly matches the end of the object name.",
"items": {
"type": "string"
}
},
"matchesStorageClass": {
"type": "array",
"description": "Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE, STANDARD, and DURABLE_REDUCED_AVAILABILITY.",
"items": {
"type": "string"
}
},
"noncurrentTimeBefore": {
"type": "string",
"description": "A date in RFC 3339 format with only the date part (for instance, \"2013-01-15\"). This condition is satisfied when the noncurrent time on an object is before this date in UTC. This condition is relevant only for versioned objects.",
"format": "date"
},
"numNewerVersions": {
"type": "integer",
"description": "Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this version of the object.",
"format": "int32"
}
}
}
}
}
}
}
},
"autoclass": {
"type": "object",
"description": "The bucket's Autoclass configuration.",
"properties": {
"enabled": {
"type": "boolean",
"description": "Whether or not Autoclass is enabled on this bucket"
},
"toggleTime": {
"type": "string",
"description": "A date and time in RFC 3339 format representing the instant at which \"enabled\" was last toggled.",
"format": "date-time"
},
"terminalStorageClass": {
"type": "string",
"description": "The storage class that objects in the bucket eventually transition to if they are not read for a certain length of time. Valid values are NEARLINE and ARCHIVE."
},
"terminalStorageClassUpdateTime": {
"type": "string",
"description": "A date and time in RFC 3339 format representing the time of the most recent update to \"terminalStorageClass\".",
"format": "date-time"
}
}
},
"location": {
"type": "string",
"description": "The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US. See the developer's guide for the authoritative list."
},
"locationType": {
"type": "string",
"description": "The type of the bucket location."
},
"logging": {
"type": "object",
"description": "The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs.",
"properties": {
"logBucket": {
"type": "string",
"description": "The destination bucket where the current bucket's logs should be placed."
},
"logObjectPrefix": {
"type": "string",
"description": "A prefix for log object names."
}
}
},
"metageneration": {
"type": "string",
"description": "The metadata generation of this bucket.",
"format": "int64"
},
"name": {
"type": "string",
"description": "The name of the bucket.",
"annotations": {
"required": [
"storage.buckets.insert"
]
}
},
"generation": {
"type": "string",
"description": "The version of the bucket.",
"format": "int64"
},
"owner": {
"type": "object",
"description": "The owner of the bucket. This is always the project team's owner group.",
"properties": {
"entity": {
"type": "string",
"description": "The entity, in the form project-owner-projectId."
},
"entityId": {
"type": "string",
"description": "The ID for the entity."
}
}
},
"projectNumber": {
"type": "string",
"description": "The project number of the project the bucket belongs to.",
"format": "uint64"
},
"retentionPolicy": {
"type": "object",
"description": "The bucket's retention policy. The retention policy enforces a minimum retention time for all objects contained in the bucket, based on their creation time. Any attempt to overwrite or delete objects younger than the retention period will result in a PERMISSION_DENIED error. An unlocked retention policy can be modified or removed from the bucket via a storage.buckets.update operation. A locked retention policy cannot be removed or shortened in duration for the lifetime of the bucket. Attempting to remove or decrease period of a locked retention policy will result in a PERMISSION_DENIED error.",
"properties": {
"effectiveTime": {
"type": "string",
"description": "Server-determined value that indicates the time from which policy was enforced and effective. This value is in RFC 3339 format.",
"format": "date-time"
},
"isLocked": {
"type": "boolean",
"description": "Once locked, an object retention policy cannot be modified."
},
"retentionPeriod": {
"type": "string",
"description": "The duration in seconds that objects need to be retained. Retention duration must be greater than zero and less than 100 years. Note that enforcement of retention periods less than a day is not guaranteed. Such periods should only be used for testing purposes.",
"format": "int64"
}
}
},
"objectRetention": {
"type": "object",
"description": "The bucket's object retention config.",
"properties": {
"mode": {
"type": "string",
"description": "The bucket's object retention mode. Can be Enabled."
}
}
},
"rpo": {
"type": "string",
"description": "The Recovery Point Objective (RPO) of this bucket. Set to ASYNC_TURBO to turn on Turbo Replication on a bucket."
},
"selfLink": {
"type": "string",
"description": "The URI of this bucket."
},
"softDeletePolicy": {
"type": "object",
"description": "The bucket's soft delete policy, which defines the period of time that soft-deleted objects will be retained, and cannot be permanently deleted.",
"properties": {
"retentionDurationSeconds": {
"type": "string",
"description": "The duration in seconds that soft-deleted objects in the bucket will be retained and cannot be permanently deleted.",
"format": "int64"
},
"effectiveTime": {
"type": "string",
"description": "Server-determined value that indicates the time from which the policy, or one with a greater retention, was effective. This value is in RFC 3339 format.",
"format": "date-time"
}
}
},
"softDeleteTime": {
"type": "string",
"description": "The time at which the bucket was soft-deleted.",
"format": "date-time"
},
"hardDeleteTime": {
"type": "string",
"description": "The time when a soft-deleted bucket is permanently deleted and can no longer be restored.",
"format": "date-time"
},
"storageClass": {
"type": "string",
"description": "The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see storage classes."
},
"timeCreated": {
"type": "string",
"description": "The creation time of the bucket in RFC 3339 format.",
"format": "date-time"
},
"updated": {
"type": "string",
"description": "The modification time of the bucket in RFC 3339 format.",
"format": "date-time"
},
"versioning": {
"type": "object",
"description": "The bucket's versioning configuration.",
"properties": {
"enabled": {
"type": "boolean",
"description": "While set to true, versioning is fully enabled for this bucket."
}
}
},
"website": {
"type": "object",
"description": "The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information.",
"properties": {
"mainPageSuffix": {
"type": "string",
"description": "If the requested object path is missing, the service will ensure the path has a trailing '/', append this suffix, and attempt to retrieve the resulting object. This allows the creation of index.html objects to represent directory pages."
},
"notFoundPage": {
"type": "string",
"description": "If the requested object path is missing, and any mainPageSuffix object is missing, if applicable, the service will return the named object from this bucket as the content for a 404 Not Found result."
}
}
},
"satisfiesPZS": {
"type": "boolean",
"description": "Reserved for future use."
}
}
},
"AnywhereCache": {
"id": "AnywhereCache",
"type": "object",
"description": "An Anywhere Cache instance.",
"properties": {
"kind": {
"type": "string",
"description": "The kind of item this is. For Anywhere Cache, this is always storage#anywhereCache.",
"default": "storage#anywhereCache"
},
"id": {
"type": "string",
"description": "The ID of the resource, including the project number, bucket name and anywhere cache ID."
},
"selfLink": {
"type": "string",
"description": "The link to this cache instance."
},
"bucket": {
"type": "string",
"description": "The name of the bucket containing this cache instance."
},
"anywhereCacheId": {
"type": "string",
"description": "The ID of the Anywhere cache instance."
},
"zone": {
"type": "string",
"description": "The zone in which the cache instance is running. For example, us-central1-a."
},
"state": {
"type": "string",
"description": "The current state of the cache instance."
},
"createTime": {
"type": "string",
"description": "The creation time of the cache instance in RFC 3339 format.",
"format": "date-time"
},
"updateTime": {
"type": "string",
"description": "The modification time of the cache instance metadata in RFC 3339 format.",
"format": "date-time"
},
"ttl": {
"type": "string",
"description": "The TTL of all cache entries in whole seconds. e.g., \"7200s\". ",
"format": "google-duration"
},
"admissionPolicy": {
"type": "string",
"description": "The cache-level entry admission policy."
},
"pendingUpdate": {
"type": "boolean",
"description": "True if the cache instance has an active Update long-running operation."
}
}
},
"AnywhereCaches": {
"id": "AnywhereCaches",
"type": "object",
"description": "A list of Anywhere Caches.",
"properties": {
"kind": {
"type": "string",
"description": "The kind of item this is. For lists of Anywhere Caches, this is always storage#anywhereCaches.",
"default": "storage#anywhereCaches"
},
"nextPageToken": {
"type": "string",
"description": "The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results."
},
"items": {
"type": "array",
"description": "The list of items.",
"items": {
"$ref": "AnywhereCache"
}
}
}
},
"BucketAccessControl": {
"id": "BucketAccessControl",
"type": "object",
"description": "An access-control entry.",
"properties": {
"bucket": {
"type": "string",
"description": "The name of the bucket."
},
"domain": {
"type": "string",
"description": "The domain associated with the entity, if any."
},
"email": {
"type": "string",
"description": "The email address associated with the entity, if any."
},
"entity": {
"type": "string",
"description": "The entity holding the permission, in one of the following forms: \n- user-userId \n- user-email \n- group-groupId \n- group-email \n- domain-domain \n- project-team-projectId \n- allUsers \n- allAuthenticatedUsers Examples: \n- The user liz@example.com would be user-liz@example.com. \n- The group example@googlegroups.com would be group-example@googlegroups.com. \n- To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com.",
"annotations": {
"required": [
"storage.bucketAccessControls.insert"
]
}
},
"entityId": {
"type": "string",
"description": "The ID for the entity, if any."
},
"etag": {
"type": "string",
"description": "HTTP 1.1 Entity tag for the access-control entry."
},
"id": {
"type": "string",
"description": "The ID of the access-control entry."
},
"kind": {
"type": "string",
"description": "The kind of item this is. For bucket access control entries, this is always storage#bucketAccessControl.",
"default": "storage#bucketAccessControl"
},
"projectTeam": {
"type": "object",
"description": "The project team associated with the entity, if any.",
"properties": {
"projectNumber": {
"type": "string",
"description": "The project number."
},
"team": {
"type": "string",
"description": "The team."
}
}
},
"role": {
"type": "string",
"description": "The access permission for the entity.",
"annotations": {
"required": [
"storage.bucketAccessControls.insert"
]
}
},
"selfLink": {
"type": "string",
"description": "The link to this access-control entry."
}
}
},
"BucketAccessControls": {
"id": "BucketAccessControls",
"type": "object",
"description": "An access-control list.",
"properties": {
"items": {
"type": "array",
"description": "The list of items.",
"items": {
"$ref": "BucketAccessControl"
}
},
"kind": {
"type": "string",
"description": "The kind of item this is. For lists of bucket access control entries, this is always storage#bucketAccessControls.",
"default": "storage#bucketAccessControls"
}
}
},
"Buckets": {
"id": "Buckets",
"type": "object",
"description": "A list of buckets.",
"properties": {
"items": {
"type": "array",
"description": "The list of items.",
"items": {
"$ref": "Bucket"
}
},
"unreachable": {
"type": "array",
"description": "The list of bucket resource names that could not be reached during the listing operation.",
"items": {
"type": "string"
}
},
"kind": {
"type": "string",
"description": "The kind of item this is. For lists of buckets, this is always storage#buckets.",
"default": "storage#buckets"
},
"nextPageToken": {
"type": "string",
"description": "The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results."
}
}
},
"Channel": {
"id": "Channel",
"type": "object",
"description": "An notification channel used to watch for resource changes.",
"properties": {
"address": {
"type": "string",
"description": "The address where notifications are delivered for this channel."
},
"expiration": {
"type": "string",
"description": "Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.",
"format": "int64"
},
"id": {
"type": "string",
"description": "A UUID or similar unique string that identifies this channel."
},
"kind": {
"type": "string",
"description": "Identifies this as a notification channel used to watch for changes to a resource, which is \"api#channel\".",
"default": "api#channel"
},
"params": {
"type": "object",
"description": "Additional parameters controlling delivery channel behavior. Optional.",
"additionalProperties": {
"type": "string",
"description": "Declares a new parameter by name."
}
},
"payload": {
"type": "boolean",
"description": "A Boolean value to indicate whether payload is wanted. Optional."
},
"resourceId": {
"type": "string",
"description": "An opaque ID that identifies the resource being watched on this channel. Stable across different API versions."
},
"resourceUri": {
"type": "string",
"description": "A version-specific identifier for the watched resource."
},
"token": {
"type": "string",
"description": "An arbitrary string delivered to the target address with each notification delivered over this channel. Optional."
},
"type": {
"type": "string",
"description": "The type of delivery mechanism used for this channel."
}
}
},
"ComposeRequest": {
"id": "ComposeRequest",
"type": "object",
"description": "A Compose request.",
"properties": {
"destination": {
"$ref": "Object",
"description": "Properties of the resulting object."
},
"kind": {
"type": "string",
"description": "The kind of item this is.",
"default": "storage#composeRequest"
},
"sourceObjects": {
"type": "array",
"description": "The list of source objects that will be concatenated into a single object.",
"items": {
"type": "object",
"properties": {
"generation": {
"type": "string",
"description": "The generation of this object to use as the source.",
"format": "int64"
},
"name": {
"type": "string",
"description": "The source object's name. All source objects must reside in the same bucket.",
"annotations": {
"required": [
"storage.objects.compose"
]
}
},
"objectPreconditions": {
"type": "object",
"description": "Conditions that must be met for this operation to execute.",
"properties": {
"ifGenerationMatch": {
"type": "string",
"description": "Only perform the composition if the generation of the source object that would be used matches this value. If this value and a generation are both specified, they must be the same value or the call will fail.",
"format": "int64"
}
}
}
}
},
"annotations": {
"required": [
"storage.objects.compose"
]
}
}
}
},
"Folder": {
"id": "Folder",
"type": "object",
"description": "A folder. Only available in buckets with hierarchical namespace enabled.",
"properties": {
"bucket": {
"type": "string",
"description": "The name of the bucket containing this folder."
},
"id": {
"type": "string",
"description": "The ID of the folder, including the bucket name, folder name."
},
"kind": {
"type": "string",
"description": "The kind of item this is. For folders, this is always storage#folder.",
"default": "storage#folder"
},
"metageneration": {
"type": "string",
"description": "The version of the metadata for this folder. Used for preconditions and for detecting changes in metadata.",
"format": "int64"
},
"name": {
"type": "string",
"description": "The name of the folder. Required if not specified by URL parameter."
},
"selfLink": {
"type": "string",
"description": "The link to this folder."
},
"createTime": {
"type": "string",
"description": "The creation time of the folder in RFC 3339 format.",
"format": "date-time"
},
"updateTime": {
"type": "string",
"description": "The modification time of the folder metadata in RFC 3339 format.",
"format": "date-time"
},
"pendingRenameInfo": {
"type": "object",
"description": "Only present if the folder is part of an ongoing rename folder operation. Contains information which can be used to query the operation status.",
"properties": {
"operationId": {
"type": "string",
"description": "The ID of the rename folder operation."
}
}
}
}
},
"Folders": {
"id": "Folders",
"type": "object",
"description": "A list of folders.",
"properties": {
"items": {
"type": "array",
"description": "The list of items.",
"items": {
"$ref": "Folder"
}
},
"kind": {
"type": "string",
"description": "The kind of item this is. For lists of folders, this is always storage#folders.",
"default": "storage#folders"
},
"nextPageToken": {
"type": "string",
"description": "The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results."
}
}
},
"Expr": {
"id": "Expr",
"type": "object",
"description": "Represents an expression text. Example: title: \"User account presence\" description: \"Determines whether the request has a user account\" expression: \"size(request.user) > 0\"",
"properties": {
"description": {
"type": "string",
"description": "An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI."
},
"expression": {
"type": "string",
"description": "Textual representation of an expression in Common Expression Language syntax. The application context of the containing message determines which well-known feature set of CEL is supported."
},
"location": {
"type": "string",
"description": "An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file."
},
"title": {
"type": "string",
"description": "An optional title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression."
}
}
},
"GoogleLongrunningOperation": {
"description": "This resource represents a long-running operation that is the result of a network API call.",
"id": "GoogleLongrunningOperation",
"properties": {
"done": {
"description": "If the value is \"false\", it means the operation is still in progress. If \"true\", the operation is completed, and either \"error\" or \"response\" is available.",
"type": "boolean"
},
"error": {
"$ref": "GoogleRpcStatus",
"description": "The error result of the operation in case of failure or cancellation."
},
"metadata": {
"additionalProperties": {
"description": "Properties of the object. Contains field @type with type URL.",
"type": "any"
},
"description": "Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.",
"type": "object"
},
"name": {
"description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the \"name\" should be a resource name ending with \"operations/{operationId}\".",
"type": "string"
},
"response": {
"additionalProperties": {
"description": "Properties of the object. Contains field @type with type URL.",
"type": "any"
},
"description": "The normal response of the operation in case of success. If the original method returns no data on success, such as \"Delete\", the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type \"XxxResponse\", where \"Xxx\" is the original method name. For example, if the original method name is \"TakeSnapshot()\", the inferred response type is \"TakeSnapshotResponse\".",
"type": "object"
}
},
"type": "object"
},
"GoogleLongrunningListOperationsResponse": {
"description": "The response message for storage.buckets.operations.list.",
"id": "GoogleLongrunningListOperationsResponse",
"properties": {
"nextPageToken": {
"type": "string",
"description": "The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results."
},
"operations": {
"description": "A list of operations that matches the specified filter in the request.",
"items": {
"$ref": "GoogleLongrunningOperation"
},
"type": "array"
}
},
"type": "object"
},
"GoogleRpcStatus": {
"description": "The \"Status\" type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each \"Status\" message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).",
"id": "GoogleRpcStatus",
"properties": {
"code": {
"description": "The status code, which should be an enum value of google.rpc.Code.",
"format": "int32",
"type": "integer"
},
"details": {
"description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.",
"items": {
"additionalProperties": {
"description": "Properties of the object. Contains field @type with type URL.",
"type": "any"
},
"type": "object"
},
"type": "array"
},
"message": {
"description": "A developer-facing error message, which should be in English.",
"type": "string"
}
},
"type": "object"
},
"HmacKey": {
"id": "HmacKey",
"type": "object",
"description": "JSON template to produce a JSON-style HMAC Key resource for Create responses.",
"properties": {
"kind": {
"type": "string",
"description": "The kind of item this is. For HMAC keys, this is always storage#hmacKey.",
"default": "storage#hmacKey"
},
"metadata": {
"$ref": "HmacKeyMetadata",
"description": "Key metadata."
},
"secret": {
"type": "string",
"description": "HMAC secret key material."
}
}
},
"HmacKeyMetadata": {
"id": "HmacKeyMetadata",
"type": "object",
"description": "JSON template to produce a JSON-style HMAC Key metadata resource.",
"properties": {
"accessId": {
"type": "string",
"description": "The ID of the HMAC Key."
},
"etag": {
"type": "string",
"description": "HTTP 1.1 Entity tag for the HMAC key."
},
"id": {
"type": "string",
"description": "The ID of the HMAC key, including the Project ID and the Access ID."
},
"kind": {
"type": "string",
"description": "The kind of item this is. For HMAC Key metadata, this is always storage#hmacKeyMetadata.",
"default": "storage#hmacKeyMetadata"
},
"projectId": {
"type": "string",
"description": "Project ID owning the service account to which the key authenticates."
},
"selfLink": {
"type": "string",
"description": "The link to this resource."
},
"serviceAccountEmail": {
"type": "string",
"description": "The email address of the key's associated service account."
},
"state": {
"type": "string",
"description": "The state of the key. Can be one of ACTIVE, INACTIVE, or DELETED."
},
"timeCreated": {
"type": "string",
"description": "The creation time of the HMAC key in RFC 3339 format.",
"format": "date-time"
},
"updated": {
"type": "string",
"description": "The last modification time of the HMAC key metadata in RFC 3339 format.",
"format": "date-time"
}
}
},
"HmacKeysMetadata": {
"id": "HmacKeysMetadata",
"type": "object",
"description": "A list of hmacKeys.",
"properties": {
"items": {
"type": "array",
"description": "The list of items.",
"items": {
"$ref": "HmacKeyMetadata"
}
},
"kind": {
"type": "string",
"description": "The kind of item this is. For lists of hmacKeys, this is always storage#hmacKeysMetadata.",
"default": "storage#hmacKeysMetadata"
},
"nextPageToken": {
"type": "string",
"description": "The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results."
}
}
},
"ManagedFolder": {
"id": "ManagedFolder",
"type": "object",
"description": "A managed folder.",
"properties": {
"bucket": {
"type": "string",
"description": "The name of the bucket containing this managed folder."
},
"id": {
"type": "string",
"description": "The ID of the managed folder, including the bucket name and managed folder name."
},
"kind": {
"type": "string",
"description": "The kind of item this is. For managed folders, this is always storage#managedFolder.",
"default": "storage#managedFolder"
},
"metageneration": {
"type": "string",
"description": "The version of the metadata for this managed folder. Used for preconditions and for detecting changes in metadata.",
"format": "int64"
},
"name": {
"type": "string",
"description": "The name of the managed folder. Required if not specified by URL parameter."
},
"selfLink": {
"type": "string",
"description": "The link to this managed folder."
},
"createTime": {
"type": "string",
"description": "The creation time of the managed folder in RFC 3339 format.",
"format": "date-time"
},
"updateTime": {
"type": "string",
"description": "The last update time of the managed folder metadata in RFC 3339 format.",
"format": "date-time"
}
}
},
"ManagedFolders": {
"id": "ManagedFolders",
"type": "object",
"description": "A list of managed folders.",
"properties": {
"items": {
"type": "array",
"description": "The list of items.",
"items": {
"$ref": "ManagedFolder"
}
},
"kind": {
"type": "string",
"description": "The kind of item this is. For lists of managed folders, this is always storage#managedFolders.",
"default": "storage#managedFolders"
},
"nextPageToken": {
"type": "string",
"description": "The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results."
}
}
},
"Notification": {
"id": "Notification",
"type": "object",
"description": "A subscription to receive Google PubSub notifications.",
"properties": {
"custom_attributes": {
"type": "object",
"description": "An optional list of additional attributes to attach to each Cloud PubSub message published for this notification subscription.",
"additionalProperties": {
"type": "string"
}
},
"etag": {
"type": "string",
"description": "HTTP 1.1 Entity tag for this subscription notification."
},
"event_types": {
"type": "array",
"description": "If present, only send notifications about listed event types. If empty, sent notifications for all event types.",
"items": {
"type": "string"
}
},
"id": {
"type": "string",
"description": "The ID of the notification."
},
"kind": {
"type": "string",
"description": "The kind of item this is. For notifications, this is always storage#notification.",
"default": "storage#notification"
},
"object_name_prefix": {
"type": "string",
"description": "If present, only apply this notification configuration to object names that begin with this prefix."
},
"payload_format": {
"type": "string",
"description": "The desired content of the Payload.",
"default": "JSON_API_V1",
"annotations": {
"required": [
"storage.notifications.insert"
]
}
},
"selfLink": {
"type": "string",
"description": "The canonical URL of this notification."
},
"topic": {
"type": "string",
"description": "The Cloud PubSub topic to which this subscription publishes. Formatted as: '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topic}'",
"annotations": {
"required": [
"storage.notifications.insert"
]
}
}
}
},
"Notifications": {
"id": "Notifications",
"type": "object",
"description": "A list of notification subscriptions.",
"properties": {
"items": {
"type": "array",
"description": "The list of items.",
"items": {
"$ref": "Notification"
}
},
"kind": {
"type": "string",
"description": "The kind of item this is. For lists of notifications, this is always storage#notifications.",
"default": "storage#notifications"
}
}
},
"Object": {
"id": "Object",
"type": "object",
"description": "An object.",
"properties": {
"acl": {
"type": "array",
"description": "Access controls on the object.",
"items": {
"$ref": "ObjectAccessControl"
},
"annotations": {
"required": [
"storage.objects.update"
]
}
},
"bucket": {
"type": "string",
"description": "The name of the bucket containing this object."
},
"cacheControl": {
"type": "string",
"description": "Cache-Control directive for the object data. If omitted, and the object is accessible to all anonymous users, the default will be public, max-age=3600."
},
"componentCount": {
"type": "integer",
"description": "Number of underlying components that make up this object. Components are accumulated by compose operations.",
"format": "int32"
},
"contentDisposition": {
"type": "string",
"description": "Content-Disposition of the object data."
},
"contentEncoding": {
"type": "string",
"description": "Content-Encoding of the object data."
},
"contentLanguage": {
"type": "string",
"description": "Content-Language of the object data."
},
"contentType": {
"type": "string",
"description": "Content-Type of the object data. If an object is stored without a Content-Type, it is served as application/octet-stream."
},
"crc32c": {
"type": "string",
"description": "CRC32c checksum, as described in RFC 4960, Appendix B; encoded using base64 in big-endian byte order. For more information about using the CRC32c checksum, see Hashes and ETags: Best Practices."
},
"customTime": {
"type": "string",
"description": "A timestamp in RFC 3339 format specified by the user for an object.",
"format": "date-time"
},
"customerEncryption": {
"type": "object",
"description": "Metadata of customer-supplied encryption key, if the object is encrypted by such a key.",
"properties": {
"encryptionAlgorithm": {
"type": "string",
"description": "The encryption algorithm."
},
"keySha256": {
"type": "string",
"description": "SHA256 hash value of the encryption key."
}
}
},
"etag": {
"type": "string",
"description": "HTTP 1.1 Entity tag for the object."
},
"eventBasedHold": {
"type": "boolean",
"description": "Whether an object is under event-based hold. Event-based hold is a way to retain objects until an event occurs, which is signified by the hold's release (i.e. this value is set to false). After being released (set to false), such objects will be subject to bucket-level retention (if any). One sample use case of this flag is for banks to hold loan documents for at least 3 years after loan is paid in full. Here, bucket-level retention is 3 years and the event is the loan being paid in full. In this example, these objects will be held intact for any number of years until the event has occurred (event-based hold on the object is released) and then 3 more years after that. That means retention duration of the objects begins from the moment event-based hold transitioned from true to false."
},
"generation": {
"type": "string",
"description": "The content generation of this object. Used for object versioning.",
"format": "int64"
},
"id": {
"type": "string",
"description": "The ID of the object, including the bucket name, object name, and generation number."
},
"kind": {
"type": "string",
"description": "The kind of item this is. For objects, this is always storage#object.",
"default": "storage#object"
},
"kmsKeyName": {
"type": "string",
"description": "Not currently supported. Specifying the parameter causes the request to fail with status code 400 - Bad Request."
},
"md5Hash": {
"type": "string",
"description": "MD5 hash of the data; encoded using base64. For more information about using the MD5 hash, see Hashes and ETags: Best Practices."
},
"mediaLink": {
"type": "string",
"description": "Media download link."
},
"metadata": {
"type": "object",
"description": "User-provided metadata, in key/value pairs.",
"additionalProperties": {
"type": "string",
"description": "An individual metadata entry."
}
},
"metageneration": {
"type": "string",
"description": "The version of the metadata for this object at this generation. Used for preconditions and for detecting changes in metadata. A metageneration number is only meaningful in the context of a particular generation of a particular object.",
"format": "int64"
},
"name": {
"type": "string",
"description": "The name of the object. Required if not specified by URL parameter."
},
"owner": {
"type": "object",
"description": "The owner of the object. This will always be the uploader of the object.",
"properties": {
"entity": {
"type": "string",
"description": "The entity, in the form user-userId."
},
"entityId": {
"type": "string",
"description": "The ID for the entity."
}
}
},
"retentionExpirationTime": {
"type": "string",
"description": "A server-determined value that specifies the earliest time that the object's retention period expires. This value is in RFC 3339 format. Note 1: This field is not provided for objects with an active event-based hold, since retention expiration is unknown until the hold is removed. Note 2: This value can be provided even when temporary hold is set (so that the user can reason about policy without having to first unset the temporary hold).",
"format": "date-time"
},
"retention": {
"type": "object",
"description": "A collection of object level retention parameters.",
"properties": {
"retainUntilTime": {
"type": "string",
"description": "A time in RFC 3339 format until which object retention protects this object.",
"format": "date-time"
},
"mode": {
"type": "string",
"description": "The bucket's object retention mode, can only be Unlocked or Locked."
}
}
},
"selfLink": {
"type": "string",
"description": "The link to this object."
},
"size": {
"type": "string",
"description": "Content-Length of the data in bytes.",
"format": "uint64"
},
"storageClass": {
"type": "string",
"description": "Storage class of the object."
},
"temporaryHold": {
"type": "boolean",
"description": "Whether an object is under temporary hold. While this flag is set to true, the object is protected against deletion and overwrites. A common use case of this flag is regulatory investigations where objects need to be retained while the investigation is ongoing. Note that unlike event-based hold, temporary hold does not impact retention expiration time of an object."
},
"timeCreated": {
"type": "string",
"description": "The creation time of the object in RFC 3339 format.",
"format": "date-time"
},
"timeDeleted": {
"type": "string",
"description": "The time at which the object became noncurrent in RFC 3339 format. Will be returned if and only if this version of the object has been deleted.",
"format": "date-time"
},
"softDeleteTime": {
"type": "string",
"description": "The time at which the object became soft-deleted in RFC 3339 format.",
"format": "date-time"
},
"hardDeleteTime": {
"type": "string",
"description": "This is the time (in the future) when the soft-deleted object will no longer be restorable. It is equal to the soft delete time plus the current soft delete retention duration of the bucket.",
"format": "date-time"
},
"timeStorageClassUpdated": {
"type": "string",
"description": "The time at which the object's storage class was last changed. When the object is initially created, it will be set to timeCreated.",
"format": "date-time"
},
"updated": {
"type": "string",
"description": "The modification time of the object metadata in RFC 3339 format. Set initially to object creation time and then updated whenever any metadata of the object changes. This includes changes made by a requester, such as modifying custom metadata, as well as changes made by Cloud Storage on behalf of a requester, such as changing the storage class based on an Object Lifecycle Configuration.",
"format": "date-time"
}
}
},
"ObjectAccessControl": {
"id": "ObjectAccessControl",
"type": "object",
"description": "An access-control entry.",
"properties": {
"bucket": {
"type": "string",
"description": "The name of the bucket."
},
"domain": {
"type": "string",
"description": "The domain associated with the entity, if any."
},
"email": {
"type": "string",
"description": "The email address associated with the entity, if any."
},
"entity": {
"type": "string",
"description": "The entity holding the permission, in one of the following forms: \n- user-userId \n- user-email \n- group-groupId \n- group-email \n- domain-domain \n- project-team-projectId \n- allUsers \n- allAuthenticatedUsers Examples: \n- The user liz@example.com would be user-liz@example.com. \n- The group example@googlegroups.com would be group-example@googlegroups.com. \n- To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com.",
"annotations": {
"required": [
"storage.defaultObjectAccessControls.insert",
"storage.objectAccessControls.insert"
]
}
},
"entityId": {
"type": "string",
"description": "The ID for the entity, if any."
},
"etag": {
"type": "string",
"description": "HTTP 1.1 Entity tag for the access-control entry."
},
"generation": {
"type": "string",
"description": "The content generation of the object, if applied to an object.",
"format": "int64"
},
"id": {
"type": "string",
"description": "The ID of the access-control entry."
},
"kind": {
"type": "string",
"description": "The kind of item this is. For object access control entries, this is always storage#objectAccessControl.",
"default": "storage#objectAccessControl"
},
"object": {
"type": "string",
"description": "The name of the object, if applied to an object."
},
"projectTeam": {
"type": "object",
"description": "The project team associated with the entity, if any.",
"properties": {
"projectNumber": {
"type": "string",
"description": "The project number."
},
"team": {
"type": "string",
"description": "The team."
}
}
},
"role": {
"type": "string",
"description": "The access permission for the entity.",
"annotations": {
"required": [
"storage.defaultObjectAccessControls.insert",
"storage.objectAccessControls.insert"
]
}
},
"selfLink": {
"type": "string",
"description": "The link to this access-control entry."
}
}
},
"ObjectAccessControls": {
"id": "ObjectAccessControls",
"type": "object",
"description": "An access-control list.",
"properties": {
"items": {
"type": "array",
"description": "The list of items.",
"items": {
"$ref": "ObjectAccessControl"
}
},
"kind": {
"type": "string",
"description": "The kind of item this is. For lists of object access control entries, this is always storage#objectAccessControls.",
"default": "storage#objectAccessControls"
}
}
},
"Objects": {
"id": "Objects",
"type": "object",
"description": "A list of objects.",
"properties": {
"items": {
"type": "array",
"description": "The list of items.",
"items": {
"$ref": "Object"
}
},
"kind": {
"type": "string",
"description": "The kind of item this is. For lists of objects, this is always storage#objects.",
"default": "storage#objects"
},
"nextPageToken": {
"type": "string",
"description": "The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results."
},
"prefixes": {
"type": "array",
"description": "The list of prefixes of objects matching-but-not-listed up to and including the requested delimiter.",
"items": {
"type": "string"
}
}
}
},
"Policy": {
"id": "Policy",
"type": "object",
"description": "A bucket/object/managedFolder IAM policy.",
"properties": {
"bindings": {
"type": "array",
"description": "An association between a role, which comes with a set of permissions, and members who may assume that role.",
"items": {
"type": "object",
"properties": {
"condition": {
"$ref": "Expr",
"description": "The condition that is associated with this binding. NOTE: an unsatisfied condition will not allow user access via current binding. Different bindings, including their conditions, are examined independently."
},
"members": {
"type": "array",
"description": "A collection of identifiers for members who may assume the provided role. Recognized identifiers are as follows: \n- allUsers \u2014 A special identifier that represents anyone on the internet; with or without a Google account. \n- allAuthenticatedUsers \u2014 A special identifier that represents anyone who is authenticated with a Google account or a service account. \n- user:emailid \u2014 An email address that represents a specific account. For example, user:alice@gmail.com or user:joe@example.com. \n- serviceAccount:emailid \u2014 An email address that represents a service account. For example, serviceAccount:my-other-app@appspot.gserviceaccount.com . \n- group:emailid \u2014 An email address that represents a Google group. For example, group:admins@example.com. \n- domain:domain \u2014 A Google Apps domain name that represents all the users of that domain. For example, domain:google.com or domain:example.com. \n- projectOwner:projectid \u2014 Owners of the given project. For example, projectOwner:my-example-project \n- projectEditor:projectid \u2014 Editors of the given project. For example, projectEditor:my-example-project \n- projectViewer:projectid \u2014 Viewers of the given project. For example, projectViewer:my-example-project",
"items": {
"type": "string"
},
"annotations": {
"required": [
"storage.buckets.setIamPolicy",
"storage.objects.setIamPolicy",
"storage.managedFolders.setIamPolicy"
]
}
},
"role": {
"type": "string",
"description": "The role to which members belong. Two types of roles are supported: new IAM roles, which grant permissions that do not map directly to those provided by ACLs, and legacy IAM roles, which do map directly to ACL permissions. All roles are of the format roles/storage.specificRole.\nThe new IAM roles are: \n- roles/storage.admin \u2014 Full control of Google Cloud Storage resources. \n- roles/storage.objectViewer \u2014 Read-Only access to Google Cloud Storage objects. \n- roles/storage.objectCreator \u2014 Access to create objects in Google Cloud Storage. \n- roles/storage.objectAdmin \u2014 Full control of Google Cloud Storage objects. The legacy IAM roles are: \n- roles/storage.legacyObjectReader \u2014 Read-only access to objects without listing. Equivalent to an ACL entry on an object with the READER role. \n- roles/storage.legacyObjectOwner \u2014 Read/write access to existing objects without listing. Equivalent to an ACL entry on an object with the OWNER role. \n- roles/storage.legacyBucketReader \u2014 Read access to buckets with object listing. Equivalent to an ACL entry on a bucket with the READER role. \n- roles/storage.legacyBucketWriter \u2014 Read access to buckets with object listing/creation/deletion. Equivalent to an ACL entry on a bucket with the WRITER role. \n- roles/storage.legacyBucketOwner \u2014 Read and write access to existing buckets with object listing/creation/deletion. Equivalent to an ACL entry on a bucket with the OWNER role.",
"annotations": {
"required": [
"storage.buckets.setIamPolicy",
"storage.objects.setIamPolicy",
"storage.managedFolders.setIamPolicy"
]
}
}
}
},
"annotations": {
"required": [
"storage.buckets.setIamPolicy",
"storage.objects.setIamPolicy",
"storage.managedFolders.setIamPolicy"
]
}
},
"etag": {
"type": "string",
"description": "HTTP 1.1 Entity tag for the policy.",
"format": "byte"
},
"kind": {
"type": "string",
"description": "The kind of item this is. For policies, this is always storage#policy. This field is ignored on input.",
"default": "storage#policy"
},
"resourceId": {
"type": "string",
"description": "The ID of the resource to which this policy belongs. Will be of the form projects/_/buckets/bucket for buckets, projects/_/buckets/bucket/objects/object for objects, and projects/_/buckets/bucket/managedFolders/managedFolder. A specific generation may be specified by appending #generationNumber to the end of the object name, e.g. projects/_/buckets/my-bucket/objects/data.txt#17. The current generation can be denoted with #0. This field is ignored on input."
},
"version": {
"type": "integer",
"description": "The IAM policy format version.",
"format": "int32"
}
}
},
"RewriteResponse": {
"id": "RewriteResponse",
"type": "object",
"description": "A rewrite response.",
"properties": {
"done": {
"type": "boolean",
"description": "true if the copy is finished; otherwise, false if the copy is in progress. This property is always present in the response."
},
"kind": {
"type": "string",
"description": "The kind of item this is.",
"default": "storage#rewriteResponse"
},
"objectSize": {
"type": "string",
"description": "The total size of the object being copied in bytes. This property is always present in the response.",
"format": "int64"
},
"resource": {
"$ref": "Object",
"description": "A resource containing the metadata for the copied-to object. This property is present in the response only when copying completes."
},
"rewriteToken": {
"type": "string",
"description": "A token to use in subsequent requests to continue copying data. This token is present in the response only when there is more data to copy."
},
"totalBytesRewritten": {
"type": "string",
"description": "The total bytes written so far, which can be used to provide a waiting user with a progress indicator. This property is always present in the response.",
"format": "int64"
}
}
},
"ServiceAccount": {
"id": "ServiceAccount",
"type": "object",
"description": "A subscription to receive Google PubSub notifications.",
"properties": {
"email_address": {
"type": "string",
"description": "The ID of the notification."
},
"kind": {
"type": "string",
"description": "The kind of item this is. For notifications, this is always storage#notification.",
"default": "storage#serviceAccount"
}
}
},
"TestIamPermissionsResponse": {
"id": "TestIamPermissionsResponse",
"type": "object",
"description": "A storage.(buckets|objects|managedFolders).testIamPermissions response.",
"properties": {
"kind": {
"type": "string",
"description": "The kind of item this is.",
"default": "storage#testIamPermissionsResponse"
},
"permissions": {
"type": "array",
"description": "The permissions held by the caller. Permissions are always of the format storage.resource.capability, where resource is one of buckets, objects, or managedFolders. The supported permissions are as follows: \n- storage.buckets.delete \u2014 Delete bucket. \n- storage.buckets.get \u2014 Read bucket metadata. \n- storage.buckets.getIamPolicy \u2014 Read bucket IAM policy. \n- storage.buckets.create \u2014 Create bucket. \n- storage.buckets.list \u2014 List buckets. \n- storage.buckets.setIamPolicy \u2014 Update bucket IAM policy. \n- storage.buckets.update \u2014 Update bucket metadata. \n- storage.objects.delete \u2014 Delete object. \n- storage.objects.get \u2014 Read object data and metadata. \n- storage.objects.getIamPolicy \u2014 Read object IAM policy. \n- storage.objects.create \u2014 Create object. \n- storage.objects.list \u2014 List objects. \n- storage.objects.setIamPolicy \u2014 Update object IAM policy. \n- storage.objects.update \u2014 Update object metadata. \n- storage.managedFolders.delete \u2014 Delete managed folder. \n- storage.managedFolders.get \u2014 Read managed folder metadata. \n- storage.managedFolders.getIamPolicy \u2014 Read managed folder IAM policy. \n- storage.managedFolders.create \u2014 Create managed folder. \n- storage.managedFolders.list \u2014 List managed folders. \n- storage.managedFolders.setIamPolicy \u2014 Update managed folder IAM policy.",
"items": {
"type": "string"
}
}
}
},
"BulkRestoreObjectsRequest": {
"id": "BulkRestoreObjectsRequest",
"type": "object",
"description": "A bulk restore objects request.",
"properties": {
"allowOverwrite": {
"type": "boolean",
"description": "If false (default), the restore will not overwrite live objects with the same name at the destination. This means some deleted objects may be skipped. If true, live objects will be overwritten resulting in a noncurrent object (if versioning is enabled). If versioning is not enabled, overwriting the object will result in a soft-deleted object. In either case, if a noncurrent object already exists with the same name, a live version can be written without issue."
},
"softDeletedAfterTime": {
"type": "string",
"description": "Restores only the objects that were soft-deleted after this time.",
"format": "date-time"
},
"softDeletedBeforeTime": {
"type": "string",
"description": "Restores only the objects that were soft-deleted before this time.",
"format": "date-time"
},
"matchGlobs": {
"type": "array",
"description": "Restores only the objects matching any of the specified glob(s). If this parameter is not specified, all objects will be restored within the specified time range.",
"items": {
"type": "string"
}
},
"copySourceAcl": {
"type": "boolean",
"description": "If true, copies the source object's ACL; otherwise, uses the bucket's default object ACL. The default is false."
}
}
}
},
"resources": {
"anywhereCaches": {
"methods": {
"insert": {
"id": "storage.anywhereCaches.insert",
"path": "b/{bucket}/anywhereCaches",
"httpMethod": "POST",
"description": "Creates an Anywhere Cache instance.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the parent bucket.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "AnywhereCache"
},
"response": {
"$ref": "GoogleLongrunningOperation"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"update": {
"id": "storage.anywhereCaches.update",
"path": "b/{bucket}/anywhereCaches/{anywhereCacheId}",
"httpMethod": "PATCH",
"description": "Updates the config(ttl and admissionPolicy) of an Anywhere Cache instance.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the parent bucket.",
"required": true,
"location": "path"
},
"anywhereCacheId": {
"type": "string",
"description": "The ID of requested Anywhere Cache instance.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"bucket",
"anywhereCacheId"
],
"request": {
"$ref": "AnywhereCache"
},
"response": {
"$ref": "GoogleLongrunningOperation"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"get": {
"id": "storage.anywhereCaches.get",
"path": "b/{bucket}/anywhereCaches/{anywhereCacheId}",
"httpMethod": "GET",
"description": "Returns the metadata of an Anywhere Cache instance.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the parent bucket.",
"required": true,
"location": "path"
},
"anywhereCacheId": {
"type": "string",
"description": "The ID of requested Anywhere Cache instance.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"bucket",
"anywhereCacheId"
],
"response": {
"$ref": "AnywhereCache"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"list": {
"id": "storage.anywhereCaches.list",
"path": "b/{bucket}/anywhereCaches",
"httpMethod": "GET",
"description": "Returns a list of Anywhere Cache instances of the bucket matching the criteria.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the parent bucket.",
"required": true,
"location": "path"
},
"pageSize": {
"type": "integer",
"description": "Maximum number of items to return in a single page of responses. Maximum 1000.",
"format": "int32",
"minimum": "0",
"location": "query"
},
"pageToken": {
"type": "string",
"description": "A previously-returned page token representing part of the larger set of results to view.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"response": {
"$ref": "AnywhereCaches"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"pause": {
"id": "storage.anywhereCaches.pause",
"path": "b/{bucket}/anywhereCaches/{anywhereCacheId}/pause",
"httpMethod": "POST",
"description": "Pauses an Anywhere Cache instance.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the parent bucket.",
"required": true,
"location": "path"
},
"anywhereCacheId": {
"type": "string",
"description": "The ID of requested Anywhere Cache instance.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"bucket",
"anywhereCacheId"
],
"response": {
"$ref": "AnywhereCache"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"resume": {
"id": "storage.anywhereCaches.resume",
"path": "b/{bucket}/anywhereCaches/{anywhereCacheId}/resume",
"httpMethod": "POST",
"description": "Resumes a paused or disabled Anywhere Cache instance.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the parent bucket.",
"required": true,
"location": "path"
},
"anywhereCacheId": {
"type": "string",
"description": "The ID of requested Anywhere Cache instance.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"bucket",
"anywhereCacheId"
],
"response": {
"$ref": "AnywhereCache"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"disable": {
"id": "storage.anywhereCaches.disable",
"path": "b/{bucket}/anywhereCaches/{anywhereCacheId}/disable",
"httpMethod": "POST",
"description": "Disables an Anywhere Cache instance.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the parent bucket.",
"required": true,
"location": "path"
},
"anywhereCacheId": {
"type": "string",
"description": "The ID of requested Anywhere Cache instance.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"bucket",
"anywhereCacheId"
],
"response": {
"$ref": "AnywhereCache"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
}
}
},
"bucketAccessControls": {
"methods": {
"delete": {
"id": "storage.bucketAccessControls.delete",
"path": "b/{bucket}/acl/{entity}",
"httpMethod": "DELETE",
"description": "Permanently deletes the ACL entry for the specified entity on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"entity"
],
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"get": {
"id": "storage.bucketAccessControls.get",
"path": "b/{bucket}/acl/{entity}",
"httpMethod": "GET",
"description": "Returns the ACL entry for the specified entity on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"entity"
],
"response": {
"$ref": "BucketAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"insert": {
"id": "storage.bucketAccessControls.insert",
"path": "b/{bucket}/acl",
"httpMethod": "POST",
"description": "Creates a new ACL entry on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "BucketAccessControl"
},
"response": {
"$ref": "BucketAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"list": {
"id": "storage.bucketAccessControls.list",
"path": "b/{bucket}/acl",
"httpMethod": "GET",
"description": "Retrieves ACL entries on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"response": {
"$ref": "BucketAccessControls"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"patch": {
"id": "storage.bucketAccessControls.patch",
"path": "b/{bucket}/acl/{entity}",
"httpMethod": "PATCH",
"description": "Patches an ACL entry on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"entity"
],
"request": {
"$ref": "BucketAccessControl"
},
"response": {
"$ref": "BucketAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"update": {
"id": "storage.bucketAccessControls.update",
"path": "b/{bucket}/acl/{entity}",
"httpMethod": "PUT",
"description": "Updates an ACL entry on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"entity"
],
"request": {
"$ref": "BucketAccessControl"
},
"response": {
"$ref": "BucketAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
}
}
},
"buckets": {
"methods": {
"delete": {
"id": "storage.buckets.delete",
"path": "b/{bucket}",
"httpMethod": "DELETE",
"description": "Permanently deletes an empty bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "If set, only deletes the bucket if its metageneration matches this value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "If set, only deletes the bucket if its metageneration does not match this value.",
"format": "int64",
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"get": {
"id": "storage.buckets.get",
"path": "b/{bucket}",
"httpMethod": "GET",
"description": "Returns metadata for the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific soft-deleted version of this bucket instead of the live version. This parameter is required if softDeleted is set to true.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to noAcl.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit owner, acl and defaultObjectAcl properties."
],
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
},
"softDeleted": {
"type": "boolean",
"description": "If true, returns the soft-deleted bucket. This parameter is required if generation is specified.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"response": {
"$ref": "Bucket"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"getIamPolicy": {
"id": "storage.buckets.getIamPolicy",
"path": "b/{bucket}/iam",
"httpMethod": "GET",
"description": "Returns an IAM policy for the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"optionsRequestedPolicyVersion": {
"type": "integer",
"description": "The IAM policy format version to be returned. If the optionsRequestedPolicyVersion is for an older version that doesn't support part of the requested IAM policy, the request fails.",
"format": "int32",
"minimum": "1",
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"insert": {
"id": "storage.buckets.insert",
"path": "b",
"httpMethod": "POST",
"description": "Creates a new bucket.",
"parameters": {
"predefinedAcl": {
"type": "string",
"description": "Apply a predefined set of access controls to this bucket.",
"enum": [
"authenticatedRead",
"private",
"projectPrivate",
"publicRead",
"publicReadWrite"
],
"enumDescriptions": [
"Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
"Project team owners get OWNER access.",
"Project team members get access according to their roles.",
"Project team owners get OWNER access, and allUsers get READER access.",
"Project team owners get OWNER access, and allUsers get WRITER access."
],
"location": "query"
},
"predefinedDefaultObjectAcl": {
"type": "string",
"description": "Apply a predefined set of default object access controls to this bucket.",
"enum": [
"authenticatedRead",
"bucketOwnerFullControl",
"bucketOwnerRead",
"private",
"projectPrivate",
"publicRead"
],
"enumDescriptions": [
"Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
"Object owner gets OWNER access, and project team owners get OWNER access.",
"Object owner gets OWNER access, and project team owners get READER access.",
"Object owner gets OWNER access.",
"Object owner gets OWNER access, and project team members get access according to their roles.",
"Object owner gets OWNER access, and allUsers get READER access."
],
"location": "query"
},
"project": {
"type": "string",
"description": "A valid API project identifier.",
"required": true,
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit owner, acl and defaultObjectAcl properties."
],
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request.",
"location": "query"
},
"enableObjectRetention": {
"type": "boolean",
"description": "When set to true, object retention is enabled for this bucket.",
"default": "false",
"location": "query"
}
},
"parameterOrder": [
"project"
],
"request": {
"$ref": "Bucket"
},
"response": {
"$ref": "Bucket"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"list": {
"id": "storage.buckets.list",
"path": "b",
"httpMethod": "GET",
"description": "Retrieves a list of buckets for a given project.",
"parameters": {
"maxResults": {
"type": "integer",
"description": "Maximum number of buckets to return in a single response. The service will use this parameter or 1,000 items, whichever is smaller.",
"default": "1000",
"format": "uint32",
"minimum": "0",
"location": "query"
},
"pageToken": {
"type": "string",
"description": "A previously-returned page token representing part of the larger set of results to view.",
"location": "query"
},
"prefix": {
"type": "string",
"description": "Filter results to buckets whose names begin with this prefix.",
"location": "query"
},
"project": {
"type": "string",
"description": "A valid API project identifier.",
"required": true,
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to noAcl.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit owner, acl and defaultObjectAcl properties."
],
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request.",
"location": "query"
},
"softDeleted": {
"type": "boolean",
"description": "If set to true, only soft-deleted bucket versions are listed as distinct results in order of bucket name and generation number. The default value is false.",
"location": "query"
},
"returnPartialSuccess": {
"type": "boolean",
"description": "If true, returns a partial list of buckets. The `unreachable` field will contain buckets that were not reachable.",
"location": "query"
}
},
"parameterOrder": [
"project"
],
"response": {
"$ref": "Buckets"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"lockRetentionPolicy": {
"id": "storage.buckets.lockRetentionPolicy",
"path": "b/{bucket}/lockRetentionPolicy",
"httpMethod": "POST",
"description": "Locks retention policy on a bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether bucket's current metageneration matches the given value.",
"required": true,
"format": "int64",
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"ifMetagenerationMatch"
],
"response": {
"$ref": "Bucket"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"patch": {
"id": "storage.buckets.patch",
"path": "b/{bucket}",
"httpMethod": "PATCH",
"description": "Patches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"predefinedAcl": {
"type": "string",
"description": "Apply a predefined set of access controls to this bucket.",
"enum": [
"authenticatedRead",
"private",
"projectPrivate",
"publicRead",
"publicReadWrite"
],
"enumDescriptions": [
"Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
"Project team owners get OWNER access.",
"Project team members get access according to their roles.",
"Project team owners get OWNER access, and allUsers get READER access.",
"Project team owners get OWNER access, and allUsers get WRITER access."
],
"location": "query"
},
"predefinedDefaultObjectAcl": {
"type": "string",
"description": "Apply a predefined set of default object access controls to this bucket.",
"enum": [
"authenticatedRead",
"bucketOwnerFullControl",
"bucketOwnerRead",
"private",
"projectPrivate",
"publicRead"
],
"enumDescriptions": [
"Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
"Object owner gets OWNER access, and project team owners get OWNER access.",
"Object owner gets OWNER access, and project team owners get READER access.",
"Object owner gets OWNER access.",
"Object owner gets OWNER access, and project team members get access according to their roles.",
"Object owner gets OWNER access, and allUsers get READER access."
],
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to full.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit owner, acl and defaultObjectAcl properties."
],
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "Bucket"
},
"response": {
"$ref": "Bucket"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"setIamPolicy": {
"id": "storage.buckets.setIamPolicy",
"path": "b/{bucket}/iam",
"httpMethod": "PUT",
"description": "Updates an IAM policy for the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "Policy"
},
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"testIamPermissions": {
"id": "storage.buckets.testIamPermissions",
"path": "b/{bucket}/iam/testPermissions",
"httpMethod": "GET",
"description": "Tests a set of permissions on the given bucket to see which, if any, are held by the caller.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"permissions": {
"type": "string",
"description": "Permissions to test.",
"required": true,
"repeated": true,
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"permissions"
],
"response": {
"$ref": "TestIamPermissionsResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"update": {
"id": "storage.buckets.update",
"path": "b/{bucket}",
"httpMethod": "PUT",
"description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"predefinedAcl": {
"type": "string",
"description": "Apply a predefined set of access controls to this bucket.",
"enum": [
"authenticatedRead",
"private",
"projectPrivate",
"publicRead",
"publicReadWrite"
],
"enumDescriptions": [
"Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
"Project team owners get OWNER access.",
"Project team members get access according to their roles.",
"Project team owners get OWNER access, and allUsers get READER access.",
"Project team owners get OWNER access, and allUsers get WRITER access."
],
"location": "query"
},
"predefinedDefaultObjectAcl": {
"type": "string",
"description": "Apply a predefined set of default object access controls to this bucket.",
"enum": [
"authenticatedRead",
"bucketOwnerFullControl",
"bucketOwnerRead",
"private",
"projectPrivate",
"publicRead"
],
"enumDescriptions": [
"Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
"Object owner gets OWNER access, and project team owners get OWNER access.",
"Object owner gets OWNER access, and project team owners get READER access.",
"Object owner gets OWNER access.",
"Object owner gets OWNER access, and project team members get access according to their roles.",
"Object owner gets OWNER access, and allUsers get READER access."
],
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to full.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit owner, acl and defaultObjectAcl properties."
],
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "Bucket"
},
"response": {
"$ref": "Bucket"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"restore": {
"id": "storage.buckets.restore",
"path": "b/{bucket}/restore",
"httpMethod": "POST",
"description": "Restores a soft-deleted bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket to be restored.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "The specific version of the bucket to be restored.",
"required": true,
"format": "int64",
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to full.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit the owner, acl property."
],
"location": "query"
}
},
"parameterOrder": [
"bucket",
"generation"
],
"response": {
"$ref": "Bucket"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
}
}
},
"operations": {
"methods": {
"cancel": {
"description": "Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed.",
"path": "b/{bucket}/operations/{operationId}/cancel",
"httpMethod": "POST",
"id": "storage.buckets.operations.cancel",
"parameterOrder": [
"bucket",
"operationId"
],
"parameters": {
"bucket": {
"description": "The parent bucket of the operation resource.",
"location": "path",
"required": true,
"type": "string"
},
"operationId": {
"description": "The ID of the operation resource.",
"location": "path",
"required": true,
"type": "string"
}
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"get": {
"description": "Gets the latest state of a long-running operation.",
"path": "b/{bucket}/operations/{operationId}",
"httpMethod": "GET",
"id": "storage.buckets.operations.get",
"parameterOrder": [
"bucket",
"operationId"
],
"parameters": {
"bucket": {
"description": "The parent bucket of the operation resource.",
"location": "path",
"required": true,
"type": "string"
},
"operationId": {
"description": "The ID of the operation resource.",
"location": "path",
"required": true,
"type": "string"
}
},
"response": {
"$ref": "GoogleLongrunningOperation"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"list": {
"description": "Lists operations that match the specified filter in the request.",
"path": "b/{bucket}/operations",
"httpMethod": "GET",
"id": "storage.buckets.operations.list",
"parameterOrder": [
"bucket"
],
"parameters": {
"filter": {
"description": "A filter to narrow down results to a preferred subset. The filtering language is documented in more detail in [AIP-160](https://google.aip.dev/160).",
"location": "query",
"type": "string"
},
"bucket": {
"description": "Name of the bucket in which to look for operations.",
"location": "path",
"required": true,
"type": "string"
},
"pageSize": {
"description": "Maximum number of items to return in a single page of responses. Fewer total results may be returned than requested. The service uses this parameter or 100 items, whichever is smaller.",
"minimum": "0",
"format": "int32",
"location": "query",
"type": "integer"
},
"pageToken": {
"description": "A previously-returned page token representing part of the larger set of results to view.",
"location": "query",
"type": "string"
}
},
"response": {
"$ref": "GoogleLongrunningListOperationsResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
}
}
},
"channels": {
"methods": {
"stop": {
"id": "storage.channels.stop",
"path": "channels/stop",
"httpMethod": "POST",
"description": "Stop watching resources through this channel",
"request": {
"$ref": "Channel",
"parameterName": "resource"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
}
}
},
"defaultObjectAccessControls": {
"methods": {
"delete": {
"id": "storage.defaultObjectAccessControls.delete",
"path": "b/{bucket}/defaultObjectAcl/{entity}",
"httpMethod": "DELETE",
"description": "Permanently deletes the default object ACL entry for the specified entity on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"entity"
],
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"get": {
"id": "storage.defaultObjectAccessControls.get",
"path": "b/{bucket}/defaultObjectAcl/{entity}",
"httpMethod": "GET",
"description": "Returns the default object ACL entry for the specified entity on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"entity"
],
"response": {
"$ref": "ObjectAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"insert": {
"id": "storage.defaultObjectAccessControls.insert",
"path": "b/{bucket}/defaultObjectAcl",
"httpMethod": "POST",
"description": "Creates a new default object ACL entry on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "ObjectAccessControl"
},
"response": {
"$ref": "ObjectAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"list": {
"id": "storage.defaultObjectAccessControls.list",
"path": "b/{bucket}/defaultObjectAcl",
"httpMethod": "GET",
"description": "Retrieves default object ACL entries on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "If present, only return default ACL listing if the bucket's current metageneration matches this value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"response": {
"$ref": "ObjectAccessControls"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"patch": {
"id": "storage.defaultObjectAccessControls.patch",
"path": "b/{bucket}/defaultObjectAcl/{entity}",
"httpMethod": "PATCH",
"description": "Patches a default object ACL entry on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"entity"
],
"request": {
"$ref": "ObjectAccessControl"
},
"response": {
"$ref": "ObjectAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"update": {
"id": "storage.defaultObjectAccessControls.update",
"path": "b/{bucket}/defaultObjectAcl/{entity}",
"httpMethod": "PUT",
"description": "Updates a default object ACL entry on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"entity"
],
"request": {
"$ref": "ObjectAccessControl"
},
"response": {
"$ref": "ObjectAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
}
}
},
"folders": {
"methods": {
"delete": {
"id": "storage.folders.delete",
"path": "b/{bucket}/folders/{folder}",
"httpMethod": "DELETE",
"description": "Permanently deletes a folder. Only applicable to buckets with hierarchical namespace enabled.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the folder resides.",
"required": true,
"location": "path"
},
"folder": {
"type": "string",
"description": "Name of a folder.",
"required": true,
"location": "path"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "If set, only deletes the folder if its metageneration matches this value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "If set, only deletes the folder if its metageneration does not match this value.",
"format": "int64",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"folder"
],
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"get": {
"id": "storage.folders.get",
"path": "b/{bucket}/folders/{folder}",
"httpMethod": "GET",
"description": "Returns metadata for the specified folder. Only applicable to buckets with hierarchical namespace enabled.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the folder resides.",
"required": true,
"location": "path"
},
"folder": {
"type": "string",
"description": "Name of a folder.",
"required": true,
"location": "path"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the return of the folder metadata conditional on whether the folder's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the return of the folder metadata conditional on whether the folder's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"folder"
],
"response": {
"$ref": "Folder"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"insert": {
"id": "storage.folders.insert",
"path": "b/{bucket}/folders",
"httpMethod": "POST",
"description": "Creates a new folder. Only applicable to buckets with hierarchical namespace enabled.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the folder resides.",
"required": true,
"location": "path"
},
"recursive": {
"type": "boolean",
"description": "If true, any parent folder which doesn\u2019t exist will be created automatically.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "Folder"
},
"response": {
"$ref": "Folder"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"list": {
"id": "storage.folders.list",
"path": "b/{bucket}/folders",
"httpMethod": "GET",
"description": "Retrieves a list of folders matching the criteria. Only applicable to buckets with hierarchical namespace enabled.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which to look for folders.",
"required": true,
"location": "path"
},
"delimiter": {
"type": "string",
"description": "Returns results in a directory-like mode. The only supported value is '/'. If set, items will only contain folders that either exactly match the prefix, or are one level below the prefix.",
"location": "query"
},
"endOffset": {
"type": "string",
"description": "Filter results to folders whose names are lexicographically before endOffset. If startOffset is also set, the folders listed will have names between startOffset (inclusive) and endOffset (exclusive).",
"location": "query"
},
"pageSize": {
"type": "integer",
"description": "Maximum number of items to return in a single page of responses.",
"format": "int32",
"minimum": "0",
"location": "query"
},
"pageToken": {
"type": "string",
"description": "A previously-returned page token representing part of the larger set of results to view.",
"location": "query"
},
"prefix": {
"type": "string",
"description": "Filter results to folders whose paths begin with this prefix. If set, the value must either be an empty string or end with a '/'.",
"location": "query"
},
"startOffset": {
"type": "string",
"description": "Filter results to folders whose names are lexicographically equal to or after startOffset. If endOffset is also set, the folders listed will have names between startOffset (inclusive) and endOffset (exclusive).",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"response": {
"$ref": "Folders"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"rename": {
"id": "storage.folders.rename",
"path": "b/{bucket}/folders/{sourceFolder}/renameTo/folders/{destinationFolder}",
"httpMethod": "POST",
"description": "Renames a source folder to a destination folder. Only applicable to buckets with hierarchical namespace enabled.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the folders are in.",
"required": true,
"location": "path"
},
"destinationFolder": {
"type": "string",
"description": "Name of the destination folder.",
"required": true,
"location": "path"
},
"ifSourceMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifSourceMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"sourceFolder": {
"type": "string",
"description": "Name of the source folder.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"bucket",
"sourceFolder",
"destinationFolder"
],
"response": {
"$ref": "GoogleLongrunningOperation"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
}
}
},
"managedFolders": {
"methods": {
"delete": {
"id": "storage.managedFolders.delete",
"path": "b/{bucket}/managedFolders/{managedFolder}",
"httpMethod": "DELETE",
"description": "Permanently deletes a managed folder.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket containing the managed folder.",
"required": true,
"location": "path"
},
"managedFolder": {
"type": "string",
"description": "The managed folder name/path.",
"required": true,
"location": "path"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "If set, only deletes the managed folder if its metageneration matches this value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "If set, only deletes the managed folder if its metageneration does not match this value.",
"format": "int64",
"location": "query"
},
"allowNonEmpty": {
"type": "boolean",
"description": "Allows the deletion of a managed folder even if it is not empty. A managed folder is empty if there are no objects or managed folders that it applies to. Callers must have storage.managedFolders.setIamPolicy permission.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"managedFolder"
],
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"get": {
"id": "storage.managedFolders.get",
"path": "b/{bucket}/managedFolders/{managedFolder}",
"httpMethod": "GET",
"description": "Returns metadata of the specified managed folder.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket containing the managed folder.",
"required": true,
"location": "path"
},
"managedFolder": {
"type": "string",
"description": "The managed folder name/path.",
"required": true,
"location": "path"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the return of the managed folder metadata conditional on whether the managed folder's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the return of the managed folder metadata conditional on whether the managed folder's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"managedFolder"
],
"response": {
"$ref": "ManagedFolder"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"getIamPolicy": {
"id": "storage.managedFolders.getIamPolicy",
"path": "b/{bucket}/managedFolders/{managedFolder}/iam",
"httpMethod": "GET",
"description": "Returns an IAM policy for the specified managed folder.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket containing the managed folder.",
"required": true,
"location": "path"
},
"optionsRequestedPolicyVersion": {
"type": "integer",
"description": "The IAM policy format version to be returned. If the optionsRequestedPolicyVersion is for an older version that doesn't support part of the requested IAM policy, the request fails.",
"format": "int32",
"minimum": "1",
"location": "query"
},
"managedFolder": {
"type": "string",
"description": "The managed folder name/path.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"managedFolder"
],
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"insert": {
"id": "storage.managedFolders.insert",
"path": "b/{bucket}/managedFolders",
"httpMethod": "POST",
"description": "Creates a new managed folder.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket containing the managed folder.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "ManagedFolder"
},
"response": {
"$ref": "ManagedFolder"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"list": {
"id": "storage.managedFolders.list",
"path": "b/{bucket}/managedFolders",
"httpMethod": "GET",
"description": "Lists managed folders in the given bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket containing the managed folder.",
"required": true,
"location": "path"
},
"pageSize": {
"type": "integer",
"description": "Maximum number of items to return in a single page of responses.",
"format": "int32",
"minimum": "0",
"location": "query"
},
"pageToken": {
"type": "string",
"description": "A previously-returned page token representing part of the larger set of results to view.",
"location": "query"
},
"prefix": {
"type": "string",
"description": "The managed folder name/path prefix to filter the output list of results.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"response": {
"$ref": "ManagedFolders"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"setIamPolicy": {
"id": "storage.managedFolders.setIamPolicy",
"path": "b/{bucket}/managedFolders/{managedFolder}/iam",
"httpMethod": "PUT",
"description": "Updates an IAM policy for the specified managed folder.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket containing the managed folder.",
"required": true,
"location": "path"
},
"managedFolder": {
"type": "string",
"description": "The managed folder name/path.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"managedFolder"
],
"request": {
"$ref": "Policy"
},
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"testIamPermissions": {
"id": "storage.managedFolders.testIamPermissions",
"path": "b/{bucket}/managedFolders/{managedFolder}/iam/testPermissions",
"httpMethod": "GET",
"description": "Tests a set of permissions on the given managed folder to see which, if any, are held by the caller.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket containing the managed folder.",
"required": true,
"location": "path"
},
"managedFolder": {
"type": "string",
"description": "The managed folder name/path.",
"required": true,
"location": "path"
},
"permissions": {
"type": "string",
"description": "Permissions to test.",
"required": true,
"repeated": true,
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"managedFolder",
"permissions"
],
"response": {
"$ref": "TestIamPermissionsResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
}
}
},
"notifications": {
"methods": {
"delete": {
"id": "storage.notifications.delete",
"path": "b/{bucket}/notificationConfigs/{notification}",
"httpMethod": "DELETE",
"description": "Permanently deletes a notification subscription.",
"parameters": {
"bucket": {
"type": "string",
"description": "The parent bucket of the notification.",
"required": true,
"location": "path"
},
"notification": {
"type": "string",
"description": "ID of the notification to delete.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"notification"
],
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"get": {
"id": "storage.notifications.get",
"path": "b/{bucket}/notificationConfigs/{notification}",
"httpMethod": "GET",
"description": "View a notification configuration.",
"parameters": {
"bucket": {
"type": "string",
"description": "The parent bucket of the notification.",
"required": true,
"location": "path"
},
"notification": {
"type": "string",
"description": "Notification ID",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"notification"
],
"response": {
"$ref": "Notification"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"insert": {
"id": "storage.notifications.insert",
"path": "b/{bucket}/notificationConfigs",
"httpMethod": "POST",
"description": "Creates a notification subscription for a given bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "The parent bucket of the notification.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "Notification"
},
"response": {
"$ref": "Notification"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"list": {
"id": "storage.notifications.list",
"path": "b/{bucket}/notificationConfigs",
"httpMethod": "GET",
"description": "Retrieves a list of notification subscriptions for a given bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a Google Cloud Storage bucket.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"response": {
"$ref": "Notifications"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
}
}
},
"objectAccessControls": {
"methods": {
"delete": {
"id": "storage.objectAccessControls.delete",
"path": "b/{bucket}/o/{object}/acl/{entity}",
"httpMethod": "DELETE",
"description": "Permanently deletes the ACL entry for the specified entity on the specified object.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object",
"entity"
],
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"get": {
"id": "storage.objectAccessControls.get",
"path": "b/{bucket}/o/{object}/acl/{entity}",
"httpMethod": "GET",
"description": "Returns the ACL entry for the specified entity on the specified object.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object",
"entity"
],
"response": {
"$ref": "ObjectAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"insert": {
"id": "storage.objectAccessControls.insert",
"path": "b/{bucket}/o/{object}/acl",
"httpMethod": "POST",
"description": "Creates a new ACL entry on the specified object.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object"
],
"request": {
"$ref": "ObjectAccessControl"
},
"response": {
"$ref": "ObjectAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"list": {
"id": "storage.objectAccessControls.list",
"path": "b/{bucket}/o/{object}/acl",
"httpMethod": "GET",
"description": "Retrieves ACL entries on the specified object.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object"
],
"response": {
"$ref": "ObjectAccessControls"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"patch": {
"id": "storage.objectAccessControls.patch",
"path": "b/{bucket}/o/{object}/acl/{entity}",
"httpMethod": "PATCH",
"description": "Patches an ACL entry on the specified object.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object",
"entity"
],
"request": {
"$ref": "ObjectAccessControl"
},
"response": {
"$ref": "ObjectAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"update": {
"id": "storage.objectAccessControls.update",
"path": "b/{bucket}/o/{object}/acl/{entity}",
"httpMethod": "PUT",
"description": "Updates an ACL entry on the specified object.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of a bucket.",
"required": true,
"location": "path"
},
"entity": {
"type": "string",
"description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object",
"entity"
],
"request": {
"$ref": "ObjectAccessControl"
},
"response": {
"$ref": "ObjectAccessControl"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
}
}
},
"objects": {
"methods": {
"compose": {
"id": "storage.objects.compose",
"path": "b/{destinationBucket}/o/{destinationObject}/compose",
"httpMethod": "POST",
"description": "Concatenates a list of existing objects into a new object in the same bucket.",
"parameters": {
"destinationBucket": {
"type": "string",
"description": "Name of the bucket containing the source objects. The destination object is stored in this bucket.",
"required": true,
"location": "path"
},
"destinationObject": {
"type": "string",
"description": "Name of the new object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"destinationPredefinedAcl": {
"type": "string",
"description": "Apply a predefined set of access controls to the destination object.",
"enum": [
"authenticatedRead",
"bucketOwnerFullControl",
"bucketOwnerRead",
"private",
"projectPrivate",
"publicRead"
],
"enumDescriptions": [
"Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
"Object owner gets OWNER access, and project team owners get OWNER access.",
"Object owner gets OWNER access, and project team owners get READER access.",
"Object owner gets OWNER access.",
"Object owner gets OWNER access, and project team members get access according to their roles.",
"Object owner gets OWNER access, and allUsers get READER access."
],
"location": "query"
},
"ifGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"kmsKeyName": {
"type": "string",
"description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"destinationBucket",
"destinationObject"
],
"request": {
"$ref": "ComposeRequest"
},
"response": {
"$ref": "Object"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"copy": {
"id": "storage.objects.copy",
"path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}",
"httpMethod": "POST",
"description": "Copies a source object to a destination object. Optionally overrides metadata.",
"parameters": {
"destinationBucket": {
"type": "string",
"description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"destinationKmsKeyName": {
"type": "string",
"description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
"location": "query"
},
"destinationObject": {
"type": "string",
"description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.",
"required": true,
"location": "path"
},
"destinationPredefinedAcl": {
"type": "string",
"description": "Apply a predefined set of access controls to the destination object.",
"enum": [
"authenticatedRead",
"bucketOwnerFullControl",
"bucketOwnerRead",
"private",
"projectPrivate",
"publicRead"
],
"enumDescriptions": [
"Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
"Object owner gets OWNER access, and project team owners get OWNER access.",
"Object owner gets OWNER access, and project team owners get READER access.",
"Object owner gets OWNER access.",
"Object owner gets OWNER access, and project team members get access according to their roles.",
"Object owner gets OWNER access, and allUsers get READER access."
],
"location": "query"
},
"ifGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the destination object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the destination object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"ifSourceGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
"format": "int64",
"location": "query"
},
"ifSourceGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
"format": "int64",
"location": "query"
},
"ifSourceMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifSourceMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit the owner, acl property."
],
"location": "query"
},
"sourceBucket": {
"type": "string",
"description": "Name of the bucket in which to find the source object.",
"required": true,
"location": "path"
},
"sourceGeneration": {
"type": "string",
"description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"sourceObject": {
"type": "string",
"description": "Name of the source object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"sourceBucket",
"sourceObject",
"destinationBucket",
"destinationObject"
],
"request": {
"$ref": "Object"
},
"response": {
"$ref": "Object"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"delete": {
"id": "storage.objects.delete",
"path": "b/{bucket}/o/{object}",
"httpMethod": "DELETE",
"description": "Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the object resides.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"ifGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object"
],
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"get": {
"id": "storage.objects.get",
"path": "b/{bucket}/o/{object}",
"httpMethod": "GET",
"description": "Retrieves an object or its metadata.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the object resides.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"ifGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to noAcl.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit the owner, acl property."
],
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
},
"softDeleted": {
"type": "boolean",
"description": "If true, only soft-deleted object versions will be listed. The default is false. For more information, see Soft Delete.",
"location": "query"
},
"restoreToken": {
"type": "string",
"description": "If you have enabled hierarchical namespace on your bucket and are working with soft-deleted objects, the restoreToken, a universally unique identifier (UUID), along with the object's name and generation value, uniquely identifies the object.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object"
],
"response": {
"$ref": "Object"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
],
"supportsMediaDownload": true,
"useMediaDownloadService": true
},
"getIamPolicy": {
"id": "storage.objects.getIamPolicy",
"path": "b/{bucket}/o/{object}/iam",
"httpMethod": "GET",
"description": "Returns an IAM policy for the specified object.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the object resides.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object"
],
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"insert": {
"id": "storage.objects.insert",
"path": "b/{bucket}/o",
"httpMethod": "POST",
"description": "Stores a new object and metadata.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
"required": true,
"location": "path"
},
"contentEncoding": {
"type": "string",
"description": "If set, sets the contentEncoding property of the final object to this value. Setting this parameter is equivalent to setting the contentEncoding metadata property. This can be useful when uploading an object with uploadType=media to indicate the encoding of the content being uploaded.",
"location": "query"
},
"ifGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"kmsKeyName": {
"type": "string",
"description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
"location": "query"
},
"name": {
"type": "string",
"description": "Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"location": "query"
},
"predefinedAcl": {
"type": "string",
"description": "Apply a predefined set of access controls to this object.",
"enum": [
"authenticatedRead",
"bucketOwnerFullControl",
"bucketOwnerRead",
"private",
"projectPrivate",
"publicRead"
],
"enumDescriptions": [
"Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
"Object owner gets OWNER access, and project team owners get OWNER access.",
"Object owner gets OWNER access, and project team owners get READER access.",
"Object owner gets OWNER access.",
"Object owner gets OWNER access, and project team members get access according to their roles.",
"Object owner gets OWNER access, and allUsers get READER access."
],
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit the owner, acl property."
],
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "Object"
},
"response": {
"$ref": "Object"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
],
"supportsMediaUpload": true,
"mediaUpload": {
"accept": [
"*/*"
],
"protocols": {
"simple": {
"multipart": true,
"path": "/upload/storage/v1/b/{bucket}/o"
},
"resumable": {
"multipart": true,
"path": "/resumable/upload/storage/v1/b/{bucket}/o"
}
}
}
},
"list": {
"id": "storage.objects.list",
"path": "b/{bucket}/o",
"httpMethod": "GET",
"description": "Retrieves a list of objects matching the criteria.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which to look for objects.",
"required": true,
"location": "path"
},
"delimiter": {
"type": "string",
"description": "Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted.",
"location": "query"
},
"endOffset": {
"type": "string",
"description": "Filter results to objects whose names are lexicographically before endOffset. If startOffset is also set, the objects listed will have names between startOffset (inclusive) and endOffset (exclusive).",
"location": "query"
},
"includeTrailingDelimiter": {
"type": "boolean",
"description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.",
"location": "query"
},
"maxResults": {
"type": "integer",
"description": "Maximum number of items plus prefixes to return in a single page of responses. As duplicate prefixes are omitted, fewer total results may be returned than requested. The service will use this parameter or 1,000 items, whichever is smaller.",
"default": "1000",
"format": "uint32",
"minimum": "0",
"location": "query"
},
"pageToken": {
"type": "string",
"description": "A previously-returned page token representing part of the larger set of results to view.",
"location": "query"
},
"prefix": {
"type": "string",
"description": "Filter results to objects whose names begin with this prefix.",
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to noAcl.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit the owner, acl property."
],
"location": "query"
},
"startOffset": {
"type": "string",
"description": "Filter results to objects whose names are lexicographically equal to or after startOffset. If endOffset is also set, the objects listed will have names between startOffset (inclusive) and endOffset (exclusive).",
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
},
"versions": {
"type": "boolean",
"description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
"location": "query"
},
"matchGlob": {
"type": "string",
"description": "Filter results to objects and prefixes that match this glob pattern.",
"location": "query"
},
"softDeleted": {
"type": "boolean",
"description": "If true, only soft-deleted object versions will be listed. The default is false. For more information, see Soft Delete.",
"location": "query"
},
"includeFoldersAsPrefixes": {
"type": "boolean",
"description": "Only applicable if delimiter is set to '/'. If true, will also include folders and managed folders (besides objects) in the returned prefixes.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"response": {
"$ref": "Objects"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
],
"supportsSubscription": true
},
"patch": {
"id": "storage.objects.patch",
"path": "b/{bucket}/o/{object}",
"httpMethod": "PATCH",
"description": "Patches an object's metadata.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the object resides.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"ifGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"overrideUnlockedRetention": {
"type": "boolean",
"description": "Must be true to remove the retention configuration, reduce its unlocked retention period, or change its mode from unlocked to locked.",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"predefinedAcl": {
"type": "string",
"description": "Apply a predefined set of access controls to this object.",
"enum": [
"authenticatedRead",
"bucketOwnerFullControl",
"bucketOwnerRead",
"private",
"projectPrivate",
"publicRead"
],
"enumDescriptions": [
"Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
"Object owner gets OWNER access, and project team owners get OWNER access.",
"Object owner gets OWNER access, and project team owners get READER access.",
"Object owner gets OWNER access.",
"Object owner gets OWNER access, and project team members get access according to their roles.",
"Object owner gets OWNER access, and allUsers get READER access."
],
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to full.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit the owner, acl property."
],
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request, for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object"
],
"request": {
"$ref": "Object"
},
"response": {
"$ref": "Object"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"move": {
"id": "storage.objects.move",
"path": "b/{bucket}/o/{sourceObject}/moveTo/o/{destinationObject}",
"httpMethod": "POST",
"description": "Moves a source object to a destination object. Optionally overrides metadata.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which to find the source object.",
"required": true,
"location": "path"
},
"sourceObject": {
"type": "string",
"description": "Name of the source object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"destinationObject": {
"type": "string",
"description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"ifGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"ifSourceGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
"format": "int64",
"location": "query"
},
"ifSourceGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
"format": "int64",
"location": "query"
},
"ifSourceMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifSourceMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"sourceObject",
"destinationObject"
],
"request": {
"$ref": "Object"
},
"response": {
"$ref": "Object"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"rewrite": {
"id": "storage.objects.rewrite",
"path": "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}",
"httpMethod": "POST",
"description": "Rewrites a source object to a destination object. Optionally overrides metadata.",
"parameters": {
"destinationBucket": {
"type": "string",
"description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
"required": true,
"location": "path"
},
"destinationKmsKeyName": {
"type": "string",
"description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.",
"location": "query"
},
"destinationObject": {
"type": "string",
"description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"destinationPredefinedAcl": {
"type": "string",
"description": "Apply a predefined set of access controls to the destination object.",
"enum": [
"authenticatedRead",
"bucketOwnerFullControl",
"bucketOwnerRead",
"private",
"projectPrivate",
"publicRead"
],
"enumDescriptions": [
"Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
"Object owner gets OWNER access, and project team owners get OWNER access.",
"Object owner gets OWNER access, and project team owners get READER access.",
"Object owner gets OWNER access.",
"Object owner gets OWNER access, and project team members get access according to their roles.",
"Object owner gets OWNER access, and allUsers get READER access."
],
"location": "query"
},
"ifGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"ifSourceGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
"format": "int64",
"location": "query"
},
"ifSourceGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
"format": "int64",
"location": "query"
},
"ifSourceMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifSourceMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"maxBytesRewrittenPerCall": {
"type": "string",
"description": "The maximum number of bytes that will be rewritten per rewrite request. Most callers shouldn't need to specify this parameter - it is primarily in place to support testing. If specified the value must be an integral multiple of 1 MiB (1048576). Also, this only applies to requests where the source and destination span locations and/or storage classes. Finally, this value must not change across rewrite calls else you'll get an error that the rewriteToken is invalid.",
"format": "int64",
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit the owner, acl property."
],
"location": "query"
},
"rewriteToken": {
"type": "string",
"description": "Include this field (from the previous rewrite response) on each rewrite request after the first one, until the rewrite response 'done' flag is true. Calls that provide a rewriteToken can omit all other request fields, but if included those fields must match the values provided in the first rewrite request.",
"location": "query"
},
"sourceBucket": {
"type": "string",
"description": "Name of the bucket in which to find the source object.",
"required": true,
"location": "path"
},
"sourceGeneration": {
"type": "string",
"description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"sourceObject": {
"type": "string",
"description": "Name of the source object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"sourceBucket",
"sourceObject",
"destinationBucket",
"destinationObject"
],
"request": {
"$ref": "Object"
},
"response": {
"$ref": "RewriteResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"setIamPolicy": {
"id": "storage.objects.setIamPolicy",
"path": "b/{bucket}/o/{object}/iam",
"httpMethod": "PUT",
"description": "Updates an IAM policy for the specified object.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the object resides.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object"
],
"request": {
"$ref": "Policy"
},
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"testIamPermissions": {
"id": "storage.objects.testIamPermissions",
"path": "b/{bucket}/o/{object}/iam/testPermissions",
"httpMethod": "GET",
"description": "Tests a set of permissions on the given object to see which, if any, are held by the caller.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the object resides.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"permissions": {
"type": "string",
"description": "Permissions to test.",
"required": true,
"repeated": true,
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object",
"permissions"
],
"response": {
"$ref": "TestIamPermissionsResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"update": {
"id": "storage.objects.update",
"path": "b/{bucket}/o/{object}",
"httpMethod": "PUT",
"description": "Updates an object's metadata.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the object resides.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
"format": "int64",
"location": "query"
},
"ifGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
"format": "int64",
"location": "query"
},
"overrideUnlockedRetention": {
"type": "boolean",
"description": "Must be true to remove the retention configuration, reduce its unlocked retention period, or change its mode from unlocked to locked.",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).",
"required": true,
"location": "path"
},
"predefinedAcl": {
"type": "string",
"description": "Apply a predefined set of access controls to this object.",
"enum": [
"authenticatedRead",
"bucketOwnerFullControl",
"bucketOwnerRead",
"private",
"projectPrivate",
"publicRead"
],
"enumDescriptions": [
"Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
"Object owner gets OWNER access, and project team owners get OWNER access.",
"Object owner gets OWNER access, and project team owners get READER access.",
"Object owner gets OWNER access.",
"Object owner gets OWNER access, and project team members get access according to their roles.",
"Object owner gets OWNER access, and allUsers get READER access."
],
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to full.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit the owner, acl property."
],
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object"
],
"request": {
"$ref": "Object"
},
"response": {
"$ref": "Object"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"watchAll": {
"id": "storage.objects.watchAll",
"path": "b/{bucket}/o/watch",
"httpMethod": "POST",
"description": "Watch for changes on all objects in a bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which to look for objects.",
"required": true,
"location": "path"
},
"delimiter": {
"type": "string",
"description": "Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted.",
"location": "query"
},
"endOffset": {
"type": "string",
"description": "Filter results to objects whose names are lexicographically before endOffset. If startOffset is also set, the objects listed will have names between startOffset (inclusive) and endOffset (exclusive).",
"location": "query"
},
"includeTrailingDelimiter": {
"type": "boolean",
"description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.",
"location": "query"
},
"maxResults": {
"type": "integer",
"description": "Maximum number of items plus prefixes to return in a single page of responses. As duplicate prefixes are omitted, fewer total results may be returned than requested. The service will use this parameter or 1,000 items, whichever is smaller.",
"default": "1000",
"format": "uint32",
"minimum": "0",
"location": "query"
},
"pageToken": {
"type": "string",
"description": "A previously-returned page token representing part of the larger set of results to view.",
"location": "query"
},
"prefix": {
"type": "string",
"description": "Filter results to objects whose names begin with this prefix.",
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to noAcl.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit the owner, acl property."
],
"location": "query"
},
"startOffset": {
"type": "string",
"description": "Filter results to objects whose names are lexicographically equal to or after startOffset. If endOffset is also set, the objects listed will have names between startOffset (inclusive) and endOffset (exclusive).",
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
},
"versions": {
"type": "boolean",
"description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
"location": "query"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "Channel",
"parameterName": "resource"
},
"response": {
"$ref": "Channel"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
],
"supportsSubscription": true
},
"restore": {
"id": "storage.objects.restore",
"path": "b/{bucket}/o/{object}/restore",
"httpMethod": "POST",
"description": "Restores a soft-deleted object.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the object resides.",
"required": true,
"location": "path"
},
"generation": {
"type": "string",
"description": "Selects a specific revision of this object.",
"required": true,
"format": "int64",
"location": "query"
},
"object": {
"type": "string",
"description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
"required": true,
"location": "path"
},
"ifGenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's one live generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.",
"format": "int64",
"location": "query"
},
"ifGenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether none of the object's live generations match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.",
"format": "int64",
"location": "query"
},
"ifMetagenerationMatch": {
"type": "string",
"description": "Makes the operation conditional on whether the object's one live metageneration matches the given value.",
"format": "int64",
"location": "query"
},
"ifMetagenerationNotMatch": {
"type": "string",
"description": "Makes the operation conditional on whether none of the object's live metagenerations match the given value.",
"format": "int64",
"location": "query"
},
"copySourceAcl": {
"type": "boolean",
"description": "If true, copies the source object's ACL; otherwise, uses the bucket's default object ACL. The default is false.",
"location": "query"
},
"projection": {
"type": "string",
"description": "Set of properties to return. Defaults to full.",
"enum": [
"full",
"noAcl"
],
"enumDescriptions": [
"Include all properties.",
"Omit the owner, acl property."
],
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request. Required for Requester Pays buckets.",
"location": "query"
},
"restoreToken": {
"type": "string",
"description": "The restoreToken is required to restore a soft-deleted object only if its name and generation value do not uniquely identify it.",
"location": "query"
}
},
"parameterOrder": [
"bucket",
"object",
"generation"
],
"response": {
"$ref": "Object"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"bulkRestore": {
"id": "storage.objects.bulkRestore",
"path": "b/{bucket}/o/bulkRestore",
"httpMethod": "POST",
"description": "Initiates a long-running bulk restore operation on the specified bucket.",
"parameters": {
"bucket": {
"type": "string",
"description": "Name of the bucket in which the object resides.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"bucket"
],
"request": {
"$ref": "BulkRestoreObjectsRequest"
},
"response": {
"$ref": "GoogleLongrunningOperation"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
}
}
},
"projects": {
"resources": {
"hmacKeys": {
"methods": {
"create": {
"id": "storage.projects.hmacKeys.create",
"path": "projects/{projectId}/hmacKeys",
"httpMethod": "POST",
"description": "Creates a new HMAC key for the specified service account.",
"parameters": {
"projectId": {
"type": "string",
"description": "Project ID owning the service account.",
"required": true,
"location": "path"
},
"serviceAccountEmail": {
"type": "string",
"description": "Email address of the service account.",
"required": true,
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request.",
"location": "query"
}
},
"parameterOrder": [
"projectId",
"serviceAccountEmail"
],
"response": {
"$ref": "HmacKey"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
},
"delete": {
"id": "storage.projects.hmacKeys.delete",
"path": "projects/{projectId}/hmacKeys/{accessId}",
"httpMethod": "DELETE",
"description": "Deletes an HMAC key.",
"parameters": {
"accessId": {
"type": "string",
"description": "Name of the HMAC key to be deleted.",
"required": true,
"location": "path"
},
"projectId": {
"type": "string",
"description": "Project ID owning the requested key",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request.",
"location": "query"
}
},
"parameterOrder": [
"projectId",
"accessId"
],
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_write"
]
},
"get": {
"id": "storage.projects.hmacKeys.get",
"path": "projects/{projectId}/hmacKeys/{accessId}",
"httpMethod": "GET",
"description": "Retrieves an HMAC key's metadata",
"parameters": {
"accessId": {
"type": "string",
"description": "Name of the HMAC key.",
"required": true,
"location": "path"
},
"projectId": {
"type": "string",
"description": "Project ID owning the service account of the requested key.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request.",
"location": "query"
}
},
"parameterOrder": [
"projectId",
"accessId"
],
"response": {
"$ref": "HmacKeyMetadata"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only"
]
},
"list": {
"id": "storage.projects.hmacKeys.list",
"path": "projects/{projectId}/hmacKeys",
"httpMethod": "GET",
"description": "Retrieves a list of HMAC keys matching the criteria.",
"parameters": {
"maxResults": {
"type": "integer",
"description": "Maximum number of items to return in a single page of responses. The service uses this parameter or 250 items, whichever is smaller. The max number of items per page will also be limited by the number of distinct service accounts in the response. If the number of service accounts in a single response is too high, the page will truncated and a next page token will be returned.",
"default": "250",
"format": "uint32",
"minimum": "0",
"location": "query"
},
"pageToken": {
"type": "string",
"description": "A previously-returned page token representing part of the larger set of results to view.",
"location": "query"
},
"projectId": {
"type": "string",
"description": "Name of the project in which to look for HMAC keys.",
"required": true,
"location": "path"
},
"serviceAccountEmail": {
"type": "string",
"description": "If present, only keys for the given service account are returned.",
"location": "query"
},
"showDeletedKeys": {
"type": "boolean",
"description": "Whether or not to show keys in the DELETED state.",
"location": "query"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request.",
"location": "query"
}
},
"parameterOrder": [
"projectId"
],
"response": {
"$ref": "HmacKeysMetadata"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only"
]
},
"update": {
"id": "storage.projects.hmacKeys.update",
"path": "projects/{projectId}/hmacKeys/{accessId}",
"httpMethod": "PUT",
"description": "Updates the state of an HMAC key. See the HMAC Key resource descriptor for valid states.",
"parameters": {
"accessId": {
"type": "string",
"description": "Name of the HMAC key being updated.",
"required": true,
"location": "path"
},
"projectId": {
"type": "string",
"description": "Project ID owning the service account of the updated key.",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request.",
"location": "query"
}
},
"parameterOrder": [
"projectId",
"accessId"
],
"request": {
"$ref": "HmacKeyMetadata"
},
"response": {
"$ref": "HmacKeyMetadata"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control"
]
}
}
},
"serviceAccount": {
"methods": {
"get": {
"id": "storage.projects.serviceAccount.get",
"path": "projects/{projectId}/serviceAccount",
"httpMethod": "GET",
"description": "Get the email address of this project's Google Cloud Storage service account.",
"parameters": {
"projectId": {
"type": "string",
"description": "Project ID",
"required": true,
"location": "path"
},
"userProject": {
"type": "string",
"description": "The project to be billed for this request.",
"location": "query"
}
},
"parameterOrder": [
"projectId"
],
"response": {
"$ref": "ServiceAccount"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"
]
}
}
}
}
}
},
"revision": "20240501",
"etag": "\"3135313638313632393935373531333737363832\""
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/CreatedHmacKey.php
================================================
createHmacKey($serviceAccountEmail);
* ```
*/
class CreatedHmacKey
{
/**
* @var HmacKey
*/
private $hmacKey;
/**
* @var string
*/
private $secret;
/**
* @param HmacKey $hmacKey The HMAC Key object.
* @param string $secret The HMAC key secret.
*/
public function __construct(HmacKey $hmacKey, $secret)
{
$this->hmacKey = $hmacKey;
$this->secret = $secret;
}
/**
* Get the HMAC key object.
*
* Example:
* ```
* $key = $response->hmacKey();
* ```
*
* @return HmacKey
*/
public function hmacKey()
{
return $this->hmacKey;
}
/**
* Get the HMAC key secret.
*
* This value will never be returned from the API after first creation. Make
* sure to record it for later use immediately upon key creation.
*
* Example:
* ```
* $secret = $response->secret();
* ```
*
* @return string
*/
public function secret()
{
return $this->secret;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/EncryptionTrait.php
================================================
'x-goog-copy-source-encryption-algorithm',
'key' => 'x-goog-copy-source-encryption-key',
'keySHA256' => 'x-goog-copy-source-encryption-key-sha256'
];
/**
* @var array
*/
private $encryptionHeaderNames = [
'algorithm' => 'x-goog-encryption-algorithm',
'key' => 'x-goog-encryption-key',
'keySHA256' => 'x-goog-encryption-key-sha256'
];
/**
* Formats options for customer-supplied encryption headers.
*
* @param array $options
* @return array
* @access private
*/
public function formatEncryptionHeaders(array $options)
{
$encryptionHeaders = [];
$useCopySourceHeaders = $options['useCopySourceHeaders'] ?? false;
$key = $options['encryptionKey'] ?? null;
$keySHA256 = $options['encryptionKeySHA256'] ?? null;
$destinationKey = $options['destinationEncryptionKey'] ?? null;
$destinationKeySHA256 = $options['destinationEncryptionKeySHA256'] ?? null;
unset($options['useCopySourceHeaders']);
unset($options['encryptionKey']);
unset($options['encryptionKeySHA256']);
unset($options['destinationEncryptionKey']);
unset($options['destinationEncryptionKeySHA256']);
$encryptionHeaders = $this->buildHeaders($key, $keySHA256, $useCopySourceHeaders)
+ $this->buildHeaders($destinationKey, $destinationKeySHA256, false);
if (!empty($encryptionHeaders)) {
if (isset($options['restOptions']['headers'])) {
$options['restOptions']['headers'] += $encryptionHeaders;
} else {
$options['restOptions']['headers'] = $encryptionHeaders;
}
}
return $options;
}
/**
* Builds out customer-supplied encryption headers.
*
* @param string $key
* @param string $keySHA256
* @param bool $useCopySourceHeaders
* @return array
*/
private function buildHeaders($key, $keySHA256, $useCopySourceHeaders)
{
if ($key) {
$headerNames = $useCopySourceHeaders
? $this->copySourceEncryptionHeaderNames
: $this->encryptionHeaderNames;
if (!$keySHA256) {
$decodedKey = base64_decode($key);
$keySHA256 = base64_encode(hash('SHA256', $decodedKey, true));
}
return [
$headerNames['algorithm'] => 'AES256',
$headerNames['key'] => $key,
$headerNames['keySHA256'] => $keySHA256
];
}
return [];
}
/**
* Sign a string using a given private key.
*
* @deprecated Please use the {@see Google\Auth\SignBlobInterface::signBlob()}
* and implementations for signing strings.
* This method will be removed in a future release.
*
* @param string $privateKey The private key to use to sign the data.
* @param string $data The data to sign.
* @param bool $forceOpenssl If true, OpenSSL will be used regardless of
* whether phpseclib is available. **Defaults to** `false`.
* @return string The signature
*/
protected function signString($privateKey, $data, $forceOpenssl = false)
{
$signature = '';
if (class_exists(RSA3::class) && !$forceOpenssl) {
$rsa = RSA3::loadPrivateKey($privateKey);
$rsa = $rsa->withPadding(RSA3::SIGNATURE_PKCS1)
->withHash('sha256');
$signature = $rsa->sign($data);
} elseif (class_exists(RSA2::class) && !$forceOpenssl) {
$rsa = new RSA2();
$rsa->loadKey($privateKey);
$rsa->setSignatureMode(RSA2::SIGNATURE_PKCS1);
$rsa->setHash('sha256');
$signature = $rsa->sign($data);
} elseif (extension_loaded('openssl')) {
openssl_sign($data, $signature, $privateKey, 'sha256WithRSAEncryption');
} else {
// @codeCoverageIgnoreStart
throw new \RuntimeException('OpenSSL is not installed.');
}
// @codeCoverageIgnoreEnd
return $signature;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/HmacKey.php
================================================
hmacKey($accessId);
* ```
*/
class HmacKey
{
/**
* @var ConnectionInterface
* @internal
*/
private $connection;
/**
* @var string
*/
private $projectId;
/**
* @var string
*/
private $accessId;
/**
* @var array|null
*/
private $info;
/**
* @param ConnectionInterface $connection A connection to Cloud Storage.
* This object is created by StorageClient,
* and should not be instantiated outside of this client.
* @param string $projectId The current project ID.
* @param string $accessId The key identifier.
* @param array|null $info The key metadata.
*/
public function __construct(
ConnectionInterface $connection,
$projectId,
$accessId,
array $info = []
) {
$this->connection = $connection;
$this->projectId = $projectId;
$this->accessId = $accessId;
$this->info = $info;
}
/**
* Get the HMAC Key Access ID.
*
* Example:
* ```
* $accessId = $hmacKey->accessId();
* ```
*
* @return string
*/
public function accessId()
{
return $this->accessId;
}
/**
* Fetch the key metadata from Cloud Storage.
*
* Example:
* ```
* $keyMetadata = $hmacKey->reload();
* ```
*
* @param array $options {
* Configuration Options
*
* @type string $userProject If set, this is the ID of the project which
* will be billed for the request. **NOTE**: This option is
* currently ignored by Cloud Storage.
* }
* @return array
*/
public function reload(array $options = [])
{
$this->info = $this->connection->getHmacKey([
'projectId' => $this->projectId,
'accessId' => $this->accessId
] + $options);
return $this->info;
}
/**
* Get the HMAC Key Metadata.
*
* If the metadata is not already available, it will be requested from Cloud
* Storage.
*
* Example:
* ```
* $keyMetadata = $hmacKey->info();
* ```
*
* @param array $options {
* Configuration Options
*
* @type string $userProject If set, this is the ID of the project which
* will be billed for the request. **NOTE**: This option is
* currently ignored by Cloud Storage.
* }
* @return array
*/
public function info(array $options = [])
{
return $this->info ?: $this->reload($options);
}
/**
* Update the HMAC Key state.
*
* Example:
* ```
* $hmacKey->update('INACTIVE');
* ```
*
* @param string $state The key state. Either `ACTIVE` or `INACTIVE`.
* @param array $options {
* Configuration Options
*
* @type string $userProject If set, this is the ID of the project which
* will be billed for the request. **NOTE**: This option is
* currently ignored by Cloud Storage.
* }
* @return array
*/
public function update($state, array $options = [])
{
$this->info = $this->connection->updateHmacKey([
'accessId' => $this->accessId,
'projectId' => $this->projectId,
'state' => $state
] + $options);
return $this->info;
}
/**
* Delete the HMAC Key.
*
* Key state must be set to `INACTIVE` prior to deletion. See
* {@see HmacKey::update()} for details.
*
* Example:
* ```
* $hmacKey->delete();
* ```
*
* @param array $options {
* Configuration Options
*
* @type string $userProject If set, this is the ID of the project which
* will be billed for the request. **NOTE**: This option is
* currently ignored by Cloud Storage.
* }
* @return void
*/
public function delete(array $options = [])
{
$this->connection->deleteHmacKey([
'accessId' => $this->accessId,
'projectId' => $this->projectId,
] + $options);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/Lifecycle.php
================================================
bucket('my-bucket');
* $lifecycle = $bucket->currentLifecycle();
* ```
*
* ```
* // Or get a fresh builder by using the static factory method.
* use Google\Cloud\Storage\Bucket;
*
* $lifecycle = Bucket::lifecycle();
* ```
*
* @see https://cloud.google.com/storage/docs/lifecycle Object Lifecycle Management API Documentation
*/
class Lifecycle implements \ArrayAccess, \IteratorAggregate
{
/**
* @var array
*/
private $lifecycle;
/**
* @param array $lifecycle [optional] A lifecycle configuration. Please see
* [here](https://cloud.google.com/storage/docs/json_api/v1/buckets#lifecycle)
* for the expected structure.
*/
public function __construct(array $lifecycle = [])
{
$this->lifecycle = $lifecycle;
}
/**
* Adds an Object Lifecycle Delete Rule.
*
* Example:
* ```
* $lifecycle->addDeleteRule([
* 'age' => 50,
* 'isLive' => true
* ]);
* ```
*
* @param array $condition {
* The condition(s) where the rule will apply.
*
* @type int $age Age of an object (in days). This condition is
* satisfied when an object reaches the specified age.
* @type \DateTimeInterface|string $createdBefore This condition is
* satisfied when an object is created before midnight of the
* specified date in UTC. If a string is given, it must be a date
* in RFC 3339 format with only the date part (for instance,
* "2013-01-15").
* @type \DateTimeInterface|string $customTimeBefore This condition is
* satisfied when the custom time on an object is before this date
* in UTC. If a string is given, it must be a date in RFC 3339
* format with only the date part (for instance, "2013-01-15").
* @type int $daysSinceCustomTime Number of days elapsed since the
* user-specified timestamp set on an object. The condition is
* satisfied if the days elapsed is at least this number. If no
* custom timestamp is specified on an object, the condition does
* not apply.
* @type int $daysSinceNoncurrentTime Number of days elapsed since the
* noncurrent timestamp of an object. The condition is satisfied
* if the days elapsed is at least this number. This condition is
* relevant only for versioned objects. The value of the field
* must be a nonnegative integer. If it's zero, the object version
* will become eligible for Lifecycle action as soon as it becomes
* noncurrent.
* @type bool $isLive Relevant only for versioned objects. If the value
* is `true`, this condition matches live objects; if the value is
* `false`, it matches archived objects.
* @type string[] $matchesStorageClass Objects having any of the storage
* classes specified by this condition will be matched. Values
* include `"MULTI_REGIONAL"`, `"REGIONAL"`, `"NEARLINE"`,
* `"ARCHIVE"`, `"COLDLINE"`, `"STANDARD"`, and
* `"DURABLE_REDUCED_AVAILABILITY"`.
* @type \DateTimeInterface|string $noncurrentTimeBefore This condition
* is satisfied when the noncurrent time on an object is before
* this timestamp. This condition is relevant only for versioned
* objects. If a string is given, it must be a date in RFC 3339
* format with only the date part (for instance, "2013-01-15").
* @type int $numNewerVersions Relevant only for versioned objects. If
* the value is N, this condition is satisfied when there are at
* least N versions (including the live version) newer than this
* version of the object.
* @type string[] $matchesPrefix Objects having names which start with
* values specified by this condition will be matched.
* @type string[] $matchesSuffix Objects having names which end with
* values specified by this condition will be matched.
* }
* @return Lifecycle
*/
public function addDeleteRule(array $condition)
{
$this->lifecycle['rule'][] = [
'action' => [
'type' => 'Delete'
],
'condition' => $this->formatCondition($condition)
];
return $this;
}
/**
* Adds a AbortIncompleteMultipartUpload lifecycle rule to Object Lifecycle.
*
* Example:
* ```
* $lifecycle->addAbortIncompleteMultipartUploadRule([
* 'age' => 50,
* 'isLive' => true
* ]);
* ```
*
* @param array $condition {
* The condition(s) where the rule will apply.
*
* @type int $age Age of an object (in days). This condition is
* satisfied when an object reaches the specified age.
* @type \DateTimeInterface|string $createdBefore This condition is
* satisfied when an object is created before midnight of the
* specified date in UTC. If a string is given, it must be a date
* in RFC 3339 format with only the date part (for instance,
* "2013-01-15").
* @type \DateTimeInterface|string $customTimeBefore This condition is
* satisfied when the custom time on an object is before this date
* in UTC. If a string is given, it must be a date in RFC 3339
* format with only the date part (for instance, "2013-01-15").
* @type int $daysSinceCustomTime Number of days elapsed since the
* user-specified timestamp set on an object. The condition is
* satisfied if the days elapsed is at least this number. If no
* custom timestamp is specified on an object, the condition does
* not apply.
* @type int $daysSinceNoncurrentTime Number of days elapsed since the
* noncurrent timestamp of an object. The condition is satisfied
* if the days elapsed is at least this number. This condition is
* relevant only for versioned objects. The value of the field
* must be a nonnegative integer. If it's zero, the object version
* will become eligible for Lifecycle action as soon as it becomes
* noncurrent.
* @type bool $isLive Relevant only for versioned objects. If the value
* is `true`, this condition matches live objects; if the value is
* `false`, it matches archived objects.
* @type string[] $matchesStorageClass Objects having any of the storage
* classes specified by this condition will be matched. Values
* include `"MULTI_REGIONAL"`, `"REGIONAL"`, `"NEARLINE"`,
* `"ARCHIVE"`, `"COLDLINE"`, `"STANDARD"`, and
* `"DURABLE_REDUCED_AVAILABILITY"`.
* @type \DateTimeInterface|string $noncurrentTimeBefore This condition
* is satisfied when the noncurrent time on an object is before
* this timestamp. This condition is relevant only for versioned
* objects. If a string is given, it must be a date in RFC 3339
* format with only the date part (for instance, "2013-01-15").
* @type int $numNewerVersions Relevant only for versioned objects. If
* the value is N, this condition is satisfied when there are at
* least N versions (including the live version) newer than this
* version of the object.
* @type string[] $matchesPrefix Objects having names which start with
* values specified by this condition will be matched.
* @type string[] $matchesSuffix Objects having names which end with
* values specified by this condition will be matched.
* }
* @return Lifecycle
*/
public function addAbortIncompleteMultipartUploadRule(array $condition)
{
$this->lifecycle['rule'][] = [
'action' => [
'type' => 'AbortIncompleteMultipartUpload'
],
'condition' => $this->formatCondition($condition)
];
return $this;
}
/**
* Adds an Object Lifecycle Set Storage Class Rule.
*
* Example:
* ```
* $lifecycle->addSetStorageClassRule('COLDLINE', [
* 'age' => 50,
* 'isLive' => true
* ]);
* ```
*
* ```
* // Using customTimeBefore rule with an object's custom time setting.
* $lifecycle->addSetStorageClassRule('NEARLINE', [
* 'customTimeBefore' => (new \DateTime())->add(
* \DateInterval::createFromDateString('+10 days')
* )
* ]);
*
* $bucket->update(['lifecycle' => $lifecycle]);
*
* $object = $bucket->object($objectName);
* $object->update([
* 'metadata' => [
* 'customTime' => '2020-08-17'
* ]
* ]);
* ```
*
* @param string $storageClass The target storage class. Values include
* `"MULTI_REGIONAL"`, `"REGIONAL"`, `"NEARLINE"`, `"COLDLINE"`,
* `"STANDARD"`, and `"DURABLE_REDUCED_AVAILABILITY"`.
* @param array $condition {
* The condition(s) where the rule will apply.
*
* @type int $age Age of an object (in days). This condition is
* satisfied when an object reaches the specified age.
* @type \DateTimeInterface|string $createdBefore This condition is
* satisfied when an object is created before midnight of the
* specified date in UTC. If a string is given, it must be a date
* in RFC 3339 format with only the date part (for instance,
* "2013-01-15").
* @type \DateTimeInterface|string $customTimeBefore This condition is
* satisfied when the custom time on an object is before this date
* in UTC. If a string is given, it must be a date in RFC 3339
* format with only the date part (for instance, "2013-01-15").
* @type int $daysSinceCustomTime Number of days elapsed since the
* user-specified timestamp set on an object. The condition is
* satisfied if the days elapsed is at least this number. If no
* custom timestamp is specified on an object, the condition does
* not apply.
* @type int $daysSinceNoncurrentTime Number of days elapsed since the
* noncurrent timestamp of an object. The condition is satisfied
* if the days elapsed is at least this number. This condition is
* relevant only for versioned objects. The value of the field
* must be a nonnegative integer. If it's zero, the object version
* will become eligible for Lifecycle action as soon as it becomes
* noncurrent.
* @type bool $isLive Relevant only for versioned objects. If the value
* is `true`, this condition matches live objects; if the value is
* `false`, it matches archived objects.
* @type string[] $matchesStorageClass Objects having any of the storage
* classes specified by this condition will be matched. Values
* include `"MULTI_REGIONAL"`, `"REGIONAL"`, `"NEARLINE"`,
* `"ARCHIVE"`, `"COLDLINE"`, `"STANDARD"`, and
* `"DURABLE_REDUCED_AVAILABILITY"`.
* @type \DateTimeInterface|string $noncurrentTimeBefore This condition
* is satisfied when the noncurrent time on an object is before
* this timestamp. This condition is relevant only for versioned
* objects. If a string is given, it must be a date in RFC 3339
* format with only the date part (for instance, "2013-01-15").
* @type int $numNewerVersions Relevant only for versioned objects. If
* the value is N, this condition is satisfied when there are at
* least N versions (including the live version) newer than this
* version of the object.
* @type string[] $matchesPrefix Objects having names which start with
* values specified by this condition will be matched.
* @type string[] $matchesSuffix Objects having names which end with
* values specified by this condition will be matched.
* }
* @return Lifecycle
*/
public function addSetStorageClassRule($storageClass, array $condition)
{
$this->lifecycle['rule'][] = [
'action' => [
'type' => 'SetStorageClass',
'storageClass' => $storageClass
],
'condition' => $this->formatCondition($condition)
];
return $this;
}
/**
* Clear all Object Lifecycle rules or rules of a certain action type.
*
* Example:
* ```
* // Remove all rules.
* $lifecycle->clearRules();
* ```
*
* ```
* // Remove all "Delete" based rules.
* $lifecycle->clearRules('Delete');
* ```
*
* ```
* // Clear any rules which have an age equal to 50.
* $lifecycle->clearRules(function (array $rule) {
* return $rule['condition']['age'] === 50
* ? false
* : true;
* });
* ```
*
* @param string|callable $action [optional] If a string is provided, it
* must be the name of the type of rule to remove (`SetStorageClass`
* or `Delete`). All rules of this type will then be cleared. When
* providing a callable you may define a custom route for how you
* would like to remove rules. The provided callable will be run
* through
* [array_filter](http://php.net/manual/en/function.array-filter.php).
* The callable's argument will be a single lifecycle rule as an
* associative array. When returning true from the callable the rule
* will be preserved, and if false it will be removed.
* **Defaults to** `null`, clearing all assigned rules.
* @return Lifecycle
* @throws \InvalidArgumentException If a type other than a string or
* callabe is provided.
*/
public function clearRules($action = null)
{
if (!$action) {
$this->lifecycle = [];
return $this;
}
if (!is_string($action) && !is_callable($action)) {
throw new \InvalidArgumentException(
sprintf(
'Expected either a string or callable, instead got \'%s\'.',
gettype($action)
)
);
}
if (isset($this->lifecycle['rule'])) {
if (is_string($action)) {
$action = function ($rule) use ($action) {
return $rule['action']['type'] !== $action;
};
}
$this->lifecycle['rule'] = array_filter(
$this->lifecycle['rule'],
$action
);
if (!$this->lifecycle['rule']) {
$this->lifecycle = [];
}
}
return $this;
}
/**
* @access private
* @return \Generator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
if (!isset($this->lifecycle['rule'])) {
return;
}
foreach ($this->lifecycle['rule'] as $rule) {
yield $rule;
}
}
/**
* @access private
* @return array
*/
public function toArray()
{
return $this->lifecycle;
}
/**
* @access private
* @param string $offset
* @param mixed $value
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$this->lifecycle['rule'][$offset] = $value;
}
/**
* @access private
* @param string $offset
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->lifecycle['rule'][$offset]);
}
/**
* @access private
* @param string $offset
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset($this->lifecycle['rule'][$offset]);
}
/**
* @access private
* @param string $offset
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return isset($this->lifecycle['rule'][$offset])
? $this->lifecycle['rule'][$offset]
: null;
}
/**
* Apply condition-specific formatting rules (such as date formatting) to
* conditions.
*
* @param array $condition
* @return array
*/
private function formatCondition(array $condition)
{
$rfc339DateFields = [
'createdBefore',
'customTimeBefore',
'noncurrentTimeBefore'
];
foreach ($rfc339DateFields as $field) {
if (isset($condition[$field]) && $condition[$field] instanceof \DateTimeInterface) {
$condition[$field] = $condition[$field]->format('Y-m-d');
}
}
return $condition;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/Notification.php
================================================
bucket('my-bucket');
* $notification = $bucket->notification('2482');
* ```
*
* @see https://cloud.google.com/storage/docs/pubsub-notifications
* @experimental The experimental flag means that while we believe this method
* or class is ready for use, it may change before release in backwards-
* incompatible ways. Please use with caution, and test thoroughly when
* upgrading.
*/
class Notification
{
use ArrayTrait;
/**
* @var ConnectionInterface Represents a connection to Cloud Storage.
* @internal
*/
private $connection;
/**
* @var array The notification's identity.
*/
private $identity;
/**
* @var array The notification's metadata.
*/
private $info;
/**
* @param ConnectionInterface $connection Represents a connection to Cloud
* Storage. This object is created by StorageClient,
* and should not be instantiated outside of this client.
* @param string $id The notification's ID.
* @param string $bucket The name of the bucket associated with this
* notification.
* @param array $info [optional] The notification's metadata.
*/
public function __construct(ConnectionInterface $connection, $id, $bucket, array $info = [])
{
$this->connection = $connection;
$this->identity = [
'bucket' => $bucket,
'notification' => $id,
'userProject' => $this->pluck('requesterProjectId', $info, false)
];
$this->info = $info;
}
/**
* Check whether or not the notification exists.
*
* Example:
* ```
* if ($notification->exists()) {
* echo 'Notification exists!';
* }
* ```
* @param array $options [optional] {
* Configuration options.
* }
* @return bool
*/
public function exists(array $options = [])
{
try {
$this->connection->getNotification($options + $this->identity + ['fields' => 'id']);
} catch (NotFoundException $ex) {
return false;
}
return true;
}
/**
* Delete the notification.
*
* Example:
* ```
* $notification->delete();
* ```
*
* @codingStandardsIgnoreStart
* @see https://cloud.google.com/storage/docs/json_api/v1/notifications/delete Notifications delete API documentation.
* @codingStandardsIgnoreEnd
*
* @param array $options [optional]
* @return void
*/
public function delete(array $options = [])
{
$this->connection->deleteNotification($options + $this->identity);
}
/**
* Retrieves the notification's details. If no notification data is cached a
* network request will be made to retrieve it.
*
* Example:
* ```
* $info = $notification->info();
* echo $info['topic'];
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/notifications/get Notifications get API documentation.
*
* @param array $options [optional]
* @return array
*/
public function info(array $options = [])
{
return $this->info ?: $this->reload($options);
}
/**
* Triggers a network request to reload the notification's details.
*
* Example:
* ```
* $notification->reload();
* $info = $notification->info();
* echo $info['topic'];
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/notifications/get Notifications get API documentation.
*
* @param array $options [optional]
* @return array
*/
public function reload(array $options = [])
{
return $this->info = $this->connection->getNotification(
$options + $this->identity
);
}
/**
* Retrieves the notification's ID.
*
* Example:
* ```
* echo $notification->id();
* ```
*
* @return string
*/
public function id()
{
return $this->identity['notification'];
}
/**
* Retrieves the notification's identity.
*
* Example:
* ```
* echo $notification->identity()['bucket'];
* ```
*
* @return array
*/
public function identity()
{
return $this->identity;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/ObjectIterator.php
================================================
*/
class ObjectIterator implements \Iterator
{
use ItemIteratorTrait;
/**
* Gets a list of prefixes of objects matching-but-not-listed up to and
* including the requested delimiter.
*
* @return array
*/
public function prefixes()
{
return method_exists($this->pageIterator, 'prefixes')
? $this->pageIterator->prefixes()
: [];
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/ObjectPageIterator.php
================================================
prefixes;
}
/**
* Get the current page.
*
* @return array|null
*/
#[\ReturnTypeWillChange]
public function current()
{
if (!$this->page) {
$this->page = $this->executeCall();
}
if (isset($this->page['prefixes'])) {
$this->updatePrefixes();
}
return $this->get($this->itemsPath, $this->page);
}
/**
* Add new prefixes to the list.
*
* @return void
*/
private function updatePrefixes()
{
foreach ($this->page['prefixes'] as $prefix) {
if (!in_array($prefix, $this->prefixes)) {
$this->prefixes[] = $prefix;
}
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/ReadStream.php
================================================
stream = $stream;
}
/**
* Return the full size of the buffer. If the underlying stream does
* not report it's size, try to fetch the size from the Content-Length
* response header.
*
* @return int The size of the stream.
*/
public function getSize(): ?int
{
return $this->stream->getSize() ?: $this->getSizeFromMetadata();
}
/**
* Attempt to fetch the size from the Content-Length response header.
* If we cannot, return 0.
*
* @return int The Size of the stream
*/
private function getSizeFromMetadata(): int
{
foreach ($this->stream->getMetadata('wrapper_data') as $value) {
if (substr($value, 0, 15) == 'Content-Length:') {
return (int) substr($value, 16);
}
}
return 0;
}
/**
* Read bytes from the underlying buffer, retrying until we have read
* enough bytes or we cannot read any more. We do this because the
* internal C code for filling a buffer does not account for when
* we try to read large chunks from a user-land stream that does not
* return enough bytes.
*
* @param int $length The number of bytes to read.
* @return string Read bytes from the underlying stream.
*/
public function read($length): string
{
$data = '';
do {
$moreData = $this->stream->read($length);
$data .= $moreData;
$readLength = strlen($moreData);
$length -= $readLength;
} while ($length > 0 && $readLength > 0);
return $data;
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/SigningHelper.php
================================================
getSigningCredentials($connection, $options);
$expires = $this->normalizeExpiration($expires);
list($resource, $bucket) = $this->normalizeResource($resource);
$options = $this->normalizeOptions($options);
$headers = $this->normalizeHeaders($options['headers']);
if ($options['virtualHostedStyle']) {
$options['bucketBoundHostname'] = sprintf(
'%s.storage.googleapis.com',
$bucket
);
}
// Make sure disallowed headers are not included.
$illegalHeaders = [
'x-goog-encryption-key',
'x-goog-encryption-key-sha256'
];
if ($illegal = array_intersect_key(array_flip($illegalHeaders), $headers)) {
throw new \InvalidArgumentException(sprintf(
'%s %s not allowed in Signed URL headers.',
implode(' and ', array_keys($illegal)),
count($illegal) === 1 ? 'is' : 'are'
));
}
// Sort headers by name.
ksort($headers);
$toSign = [
$options['method'],
$options['contentMd5'],
$options['contentType'],
$expires,
];
$signedHeaders = [];
foreach ($headers as $name => $value) {
$signedHeaders[] = $name . ':' . $value;
}
// Push the headers onto the end of the signing string.
if ($signedHeaders) {
$toSign = array_merge($toSign, $signedHeaders);
}
$toSign[] = $resource;
$stringToSign = $this->createV2CanonicalRequest($toSign);
// Use exponential backOff
$signature = $this->retrySignBlob(fn () => $credentials->signBlob($stringToSign, [
'forceOpenssl' => $options['forceOpenssl']
]));
// Start with user-provided query params and add required parameters.
$params = $options['queryParams'];
$params['GoogleAccessId'] = $credentials->getClientName();
$params['Expires'] = $expires;
$params['Signature'] = $signature;
// urlencode parameter values
foreach ($params as &$value) {
$value = rawurlencode($value ?? '');
}
$params = $this->addCommonParams($generation, $params, $options);
$queryString = $this->buildQueryString($params);
$resource = $this->normalizeUriPath($options['bucketBoundHostname'], $resource);
return 'https://' . $options['bucketBoundHostname'] . $resource . '?' . $queryString;
}
/**
* Sign a storage URL using Google Signed URLs v4.
*
* @param ConnectionInterface $connection A connection to the Cloud Storage
* API. This object is created by StorageClient,
* and should not be instantiated outside of this client.
* @param Timestamp|\DateTimeInterface|int $expires The signed URL
* expiration.
* @param string $resource The URI to the storage resource, preceded by a
* leading slash.
* @param int|null $generation The resource generation.
* @param array $options Configuration options. See
* {@see StorageObject::signedUrl()} for
* details.
* @return string
* @throws \InvalidArgumentException
* @throws \RuntimeException If required data could not be gathered from
* credentials.
* @throws \RuntimeException If OpenSSL signing is required by user input
* and OpenSSL is not available.
*/
public function v4Sign(ConnectionInterface $connection, $expires, $resource, $generation, array $options)
{
list($credentials, $options) = $this->getSigningCredentials($connection, $options);
$expires = $this->normalizeExpiration($expires);
list($resource, $bucket) = $this->normalizeResource($resource);
$options = $this->normalizeOptions($options);
$time = $options['timestamp'];
$requestTimestamp = $time->format(self::V4_TIMESTAMP_FORMAT);
$requestDatestamp = $time->format(self::V4_DATESTAMP_FORMAT);
$timeSeconds = $time->format('U');
$expireLimit = $timeSeconds + 604800;
if ($expires > $expireLimit) {
throw new \InvalidArgumentException(
'V4 Signed URLs may not have an expiration greater than seven days in the future.'
);
}
$clientEmail = $credentials->getClientName();
$credentialScope = sprintf('%s/auto/storage/goog4_request', $requestDatestamp);
$credential = sprintf('%s/%s', $clientEmail, $credentialScope);
if ($options['virtualHostedStyle']) {
$options['bucketBoundHostname'] = sprintf(
'%s.storage.googleapis.com',
$bucket
);
}
// Add headers and query params based on provided options.
$params = $options['queryParams'];
$headers = $options['headers'] + [
'host' => $options['bucketBoundHostname']
];
if ($options['contentType']) {
$headers['content-type'] = $options['contentType'];
}
if ($options['contentMd5']) {
$headers['content-md5'] = $options['contentMd5'];
}
$params = $this->addCommonParams($generation, $params, $options);
$headers = $this->normalizeHeaders($headers);
// sort headers by name
ksort($headers, SORT_NATURAL | SORT_FLAG_CASE);
// Canonical headers are a list, newline separated, of keys and values,
// comma separated.
// Signed headers are a list of keys, separated by a semicolon.
$canonicalHeaders = [];
$signedHeaders = [];
foreach ($headers as $key => $val) {
$canonicalHeaders[] = sprintf('%s:%s', $key, $val);
$signedHeaders[] = $key;
}
$canonicalHeaders = implode("\n", $canonicalHeaders) . "\n";
$signedHeaders = implode(';', $signedHeaders);
// Add required query parameters.
$params = [
'X-Goog-Algorithm' => self::V4_ALGO_NAME,
'X-Goog-Credential' => $credential,
'X-Goog-Date' => $requestTimestamp,
'X-Goog-Expires' => $expires - $timeSeconds,
'X-Goog-SignedHeaders' => $signedHeaders,
] + $params;
$paramNames = [];
foreach ($params as $key => $val) {
$paramNames[] = $key;
}
sort($paramNames, SORT_REGULAR);
$sortedParams = [];
foreach ($paramNames as $name) {
$sortedParams[rawurlencode($name)] = rawurlencode($params[$name]);
}
$canonicalQueryString = $this->buildQueryString($sortedParams);
$canonicalResource = $this->normalizeCanonicalRequestResource(
$resource,
$options['bucketBoundHostname'],
$options['virtualHostedStyle']
);
$canonicalRequest = [
$options['method'],
$canonicalResource,
$canonicalQueryString,
$canonicalHeaders,
$signedHeaders,
$this->getPayloadHash($headers)
];
$requestHash = $this->createV4CanonicalRequest($canonicalRequest);
// Construct the string to sign.
$stringToSign = implode("\n", [
self::V4_ALGO_NAME,
$requestTimestamp,
$credentialScope,
$requestHash
]);
$signature = bin2hex(base64_decode($this->retrySignBlob(
fn () => $credentials->signBlob($stringToSign, [
'forceOpenssl' => $options['forceOpenssl']
])
) ?? ''));
// Construct the modified resource name. If a custom hostname is provided,
// this will remove the bucket name from the resource.
$resource = $this->normalizeUriPath($options['bucketBoundHostname'], $resource);
$scheme = $this->chooseScheme(
$options['scheme'],
$options['bucketBoundHostname'],
$options['virtualHostedStyle']
);
return sprintf(
'%s://%s%s?%s&X-Goog-Signature=%s',
$scheme,
$options['bucketBoundHostname'],
$resource,
$canonicalQueryString,
$signature
);
}
/**
* Create an HTTP POST policy using v4 signing.
*
* @param ConnectionInterface $connection A Connection to Google Cloud Storage.
* This object is created by StorageClient,
* and should not be instantiated outside of this client.
* @param Timestamp|\DateTimeInterface|int $expires The signed URL
* expiration.
* @param string $resource The URI to the storage resource, preceded by a
* leading slash.
* @param array $options Configuration options. See
* {@see Bucket::generateSignedPostPolicyV4()} for details.
* @return array An associative array, containing (string) `uri` and
* (array) `fields` keys.
*/
public function v4PostPolicy(
ConnectionInterface $connection,
$expires,
$resource,
array $options = []
) {
list($credentials, $options) = $this->getSigningCredentials($connection, $options);
$expires = $this->normalizeExpiration($expires);
list($resource, $bucket, $object) = $this->normalizeResource($resource, false);
$object = trim($object, '/');
$options = $this->normalizeOptions($options) + [
'fields' => [],
'conditions' => [],
'successActionRedirect' => null,
'successActionStatus' => null
];
$time = $options['timestamp'];
$requestTimestamp = $time->format(self::V4_TIMESTAMP_FORMAT);
$requestDatestamp = $time->format(self::V4_DATESTAMP_FORMAT);
$expiration = \DateTimeImmutable::createFromFormat('U', (string) $expires);
$expirationTimestamp = str_replace(
'+00:00',
'Z',
$expiration->format(\DateTime::RFC3339)
);
$clientEmail = $credentials->getClientName();
$credentialScope = sprintf('%s/auto/storage/goog4_request', $requestDatestamp);
$credential = sprintf('%s/%s', $clientEmail, $credentialScope);
if ($options['virtualHostedStyle']) {
$options['bucketBoundHostname'] = sprintf(
'%s.storage.googleapis.com',
$bucket
);
}
$fields = array_merge($options['fields'], [
'key' => $object,
'x-goog-algorithm' => self::V4_ALGO_NAME,
'x-goog-credential' => $credential,
'x-goog-date' => $requestTimestamp
]);
$conditions = $options['conditions'];
foreach ($options['fields'] as $key => $value) {
$conditions[] = [$key => $value];
}
foreach ($conditions as $key => $value) {
$key = $key;
$value = $value;
$conditions[$key] = $value;
}
$conditions = array_merge($conditions, [
['bucket' => $bucket],
['key' => $object],
['x-goog-date' => $requestTimestamp],
['x-goog-credential' => $credential],
['x-goog-algorithm' => self::V4_ALGO_NAME],
]);
$policy = [
'conditions' => $conditions,
'expiration' => $expirationTimestamp
];
$json = str_replace('\\\u', '\\u', json_encode($policy, JSON_UNESCAPED_SLASHES));
$stringToSign = base64_encode($json);
$signature = bin2hex(base64_decode($credentials->signBlob($stringToSign, [
'forceOpenssl' => $options['forceOpenssl']
])));
$fields['x-goog-signature'] = $signature;
$fields['policy'] = $stringToSign;
// Construct the modified resource name. If a custom hostname is provided,
// this will remove the bucket name from the resource.
$resource = $this->normalizeUriPath($options['bucketBoundHostname'], '/' . $bucket, true);
$scheme = $this->chooseScheme(
$options['scheme'],
$options['bucketBoundHostname'],
$options['virtualHostedStyle']
);
return [
'url' => sprintf(
'%s://%s%s',
$scheme,
$options['bucketBoundHostname'],
$resource
),
'fields' => $fields
];
}
/**
* Creates a canonical request hash for a V4 Signed URL.
*
* NOTE: While in most cases `PHP_EOL` is preferable to a system-specific
* character, in this case `\n` is required.
*
* @param array $canonicalRequest The canonical request, with each element
* representing a line in the request.
* @return string
*/
private function createV4CanonicalRequest(array $canonicalRequest)
{
$canonicalRequestString = implode("\n", $canonicalRequest);
return bin2hex(hash('sha256', $canonicalRequestString, true));
}
/**
* Creates a canonical request for a V2 Signed URL.
*
* NOTE: While in most cases `PHP_EOL` is preferable to a system-specific
* character, in this case `\n` is required.
*
* @param array $canonicalRequest The canonical request, with each element
* representing a line in the request.
* @return string
*/
private function createV2CanonicalRequest(array $canonicalRequest)
{
return implode("\n", $canonicalRequest);
}
/**
* Choose the correct URL scheme.
*
* @param string $scheme The scheme provided by the user or defaults.
* @param string $bucketBoundHostname The bucketBoundHostname provided by the user or defaults.
* @param bool $virtualHostedStyle Whether virtual host style is enabled.
* @return string
*/
private function chooseScheme($scheme, $bucketBoundHostname, $virtualHostedStyle = false)
{
// bucketBoundHostname not used -- always https.
if ($bucketBoundHostname === self::DEFAULT_DOWNLOAD_HOST) {
return 'https';
}
// virtualHostedStyle enabled -- always https.
if ($virtualHostedStyle) {
return 'https';
}
// not virtual hosted style, and custom hostname -- use default (http) or user choice.
return $scheme;
}
/**
* If `X-Goog-Content-SHA256` header is provided, use that as the payload.
* Otherwise, `UNSIGNED-PAYLOAD`.
*
* @param array $headers
* @return string
*/
private function getPayloadHash(array $headers)
{
if (!isset($headers['x-goog-content-sha256'])) {
return 'UNSIGNED-PAYLOAD';
}
return $headers['x-goog-content-sha256'];
}
/**
* Normalizes and validates an expiration.
*
* @param Timestamp|\DateTimeInterface|int $expires The expiration
* @return int
* @throws \InvalidArgumentException If an invalid value is given.
*/
private function normalizeExpiration($expires)
{
if ($expires instanceof Timestamp) {
$seconds = $expires->get()->format('U');
} elseif ($expires instanceof \DateTimeInterface) {
$seconds = $expires->format('U');
} elseif (is_numeric($expires)) {
$seconds = (int) $expires;
} else {
throw new \InvalidArgumentException('Invalid expiration.');
}
return $seconds;
}
/**
* Normalizes and encodes the resource identifier.
*
* @param string $resource The resource identifier. In form
* `[/]$bucket/$object`.
* @return array A list, where index 0 is the resource path, with pieces
* encoded and prefixed with a forward slash, index 1 is the bucket
* name, and index 2 is the object name, relative to the bucket.
*/
private function normalizeResource($resource, $urlencode = true)
{
$pieces = explode('/', trim($resource, '/'));
if ($urlencode) {
array_walk($pieces, function (&$piece) {
$piece = rawurlencode($piece);
});
}
$bucket = $pieces[0];
$relative = $pieces;
array_shift($relative);
return [
'/' . implode('/', $pieces),
$bucket,
'/' . implode('/', $relative),
];
}
/**
* Fixes the user input options, filters and validates data.
*
* @param array $options Signed URL configuration options.
* @return array
* @throws \InvalidArgumentException
*/
private function normalizeOptions(array $options)
{
$options += [
'allowPost' => false,
'cname' => null, //@deprecated
'bucketBoundHostname' => self::DEFAULT_DOWNLOAD_HOST,
'contentMd5' => null,
'contentType' => null,
'forceOpenssl' => false,
'headers' => [],
'keyFile' => null,
'keyFilePath' => null,
'credentialsFetcher' => null,
'method' => 'GET',
'queryParams' => [],
'responseDisposition' => null,
'responseType' => null,
'saveAsName' => null,
// note that in almost every case this default will be overridden.
'scheme' => 'http',
'timestamp' => null,
'virtualHostedStyle' => false,
];
$allowedMethods = ['GET', 'PUT', 'POST', 'DELETE'];
$options['method'] = strtoupper($options['method']);
if (!in_array($options['method'], $allowedMethods)) {
throw new \InvalidArgumentException('$options.method must be one of `GET`, `PUT` or `DELETE`.');
}
if ($options['method'] === 'POST' && !$options['allowPost']) {
throw new \InvalidArgumentException(
'Invalid method. To create an upload URI, use StorageObject::signedUploadUrl().'
);
}
// Rewrite deprecated `cname` to new `bucketBoundHostname`.
if ($options['cname'] && $options['bucketBoundHostname'] === self::DEFAULT_DOWNLOAD_HOST) {
$options['bucketBoundHostname'] = $options['cname'];
}
// strip protocol from hostname.
$hostnameParts = explode('//', $options['bucketBoundHostname']);
if (count($hostnameParts) > 1) {
$options['bucketBoundHostname'] = $hostnameParts[1];
}
$options['bucketBoundHostname'] = trim($options['bucketBoundHostname'], '/');
// If a timestamp is provided, use it in place of `now` for v4 URLs only..
// This option exists for testing purposes, and should not generally be provided by users.
if ($options['timestamp']) {
if (!($options['timestamp'] instanceof \DateTimeInterface)) {
if (!is_string($options['timestamp'])) {
throw new \InvalidArgumentException(
'User-provided timestamps must be a string or instance of `\DateTimeInterface`.'
);
}
$options['timestamp'] = \DateTimeImmutable::createFromFormat(
\DateTime::RFC3339,
$options['timestamp'],
new \DateTimeZone('UTC')
);
if (!$options['timestamp']) {
throw new \InvalidArgumentException(
'Given timestamp string is in an invalid format. Provide timestamp formatted as follows: `' .
\DateTime::RFC3339 .
'`. Note that timestamps MUST be in UTC.'
);
}
}
} else {
$options['timestamp'] = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
}
unset(
$options['cname'],
$options['allowPost']
);
return $options;
}
/**
* Cleans and normalizes header values.
*
* Arrays of values are collapsed into a comma-separated list, trailing and
* leading spaces are removed, newlines are replaced by empty strings, and
* multiple whitespace chars are replaced by a single space.
*
* @param array $headers Input headers
* @return array
*/
private function normalizeHeaders(array $headers)
{
$out = [];
foreach ($headers as $name => $value) {
$name = strtolower(trim($name));
// collapse arrays of values into a comma-separated list.
if (!is_array($value)) {
$value = [$value];
}
foreach ($value as &$headerValue) {
// strip trailing and leading spaces.
$headerValue = trim($headerValue);
// replace newlines with empty strings.
$headerValue = str_replace(PHP_EOL, '', $headerValue);
// collapse multiple whitespace chars to a single space.
$headerValue = preg_replace('/[\s]+/', ' ', $headerValue);
}
$out[$name] = implode(', ', $value);
}
return $out;
}
/**
* Returns a resource formatted for use in a URI.
*
* If the bucketBoundHostname is other than the default, will omit the bucket name.
*
* @param string $bucketBoundHostname The bucketBoundHostname provided by the user, or the default
* value.
* @param string $resource The GCS resource path (i.e. /bucket/object).
* @return string
*/
private function normalizeUriPath($bucketBoundHostname, $resource, $withTrailingSlash = false)
{
if ($bucketBoundHostname !== self::DEFAULT_DOWNLOAD_HOST) {
$resourceParts = explode('/', trim($resource, '/'));
array_shift($resourceParts);
// Resource is a Bucket.
if (empty($resourceParts)) {
$resource = '/';
} else {
$resource = '/' . implode('/', $resourceParts);
}
}
$resource = rtrim($resource, '/');
return $withTrailingSlash
? $resource . '/'
: $resource;
}
/**
* Normalize the resource provided to the canonical request string.
*
* @param string $resource
* @param string $bucketBoundHostname
* @param boolean $virtualHostedStyle
* @return string
*/
private function normalizeCanonicalRequestResource($resource, $bucketBoundHostname, $virtualHostedStyle = false)
{
if ($bucketBoundHostname === self::DEFAULT_DOWNLOAD_HOST && !$virtualHostedStyle) {
return $resource;
}
$pieces = explode('/', trim($resource, '/'));
array_shift($pieces);
return '/' . implode('/', $pieces);
}
/**
* Get the credentials for use with signing.
*
* @param ConnectionInterface $connection A Storage connection object.
* This object is created by StorageClient,
* and should not be instantiated outside of this client.
* @param array $options Configuration options.
* @return array A list containing a credentials object at index 0 and the
* modified options at index 1.
* @throws \RuntimeException If the credentials type is not valid for signing.
* @throws \InvalidArgumentException If a keyfile is given and is not valid.
*/
private function getSigningCredentials(ConnectionInterface $connection, array $options)
{
$keyFilePath = $options['keyFilePath'] ?? null;
if ($keyFilePath) {
if (!file_exists($keyFilePath)) {
throw new \InvalidArgumentException(sprintf(
'Keyfile path %s does not exist.',
$keyFilePath
));
}
$options['keyFile'] = self::jsonDecode(file_get_contents($keyFilePath), true);
}
$rw = $connection->requestWrapper();
$keyFile = $options['keyFile'] ?? null;
if ($keyFile) {
$scopes = $options['scopes'] ?? $rw->scopes();
$credentials = CredentialsLoader::makeCredentials($scopes, $keyFile);
} elseif (isset($options['credentialsFetcher'])) {
$credentials = $options['credentialsFetcher'];
} else {
$credentials = $rw->getCredentialsFetcher();
}
//@codeCoverageIgnoreStart
if (!($credentials instanceof SignBlobInterface)) {
throw new \RuntimeException(sprintf(
'Credentials object is of type `%s` and is not valid for signing.',
get_class($credentials)
));
}
//@codeCoverageIgnoreEnd
unset(
$options['keyFilePath'],
$options['keyFile'],
$options['credentialsFetcher'],
$options['scopes']
);
return [$credentials, $options];
}
/**
* Add parameters common to all signed URL versions.
*
* @param int|null $generation
* @param array $params
* @param array $options
* @return array
*/
private function addCommonParams($generation, array $params, array $options)
{
if ($options['responseType']) {
$params['response-content-type'] = $options['responseType'];
}
if ($options['responseDisposition']) {
$params['response-content-disposition'] = $options['responseDisposition'];
} elseif ($options['saveAsName']) {
$params['response-content-disposition'] = 'attachment; filename='
. '"' . $options['saveAsName'] . '"';
}
if ($generation) {
$params['generation'] = $generation;
}
return $params;
}
/**
* Create a query string from an array.
*
* Note that this method does NOT urlencode keys or values.
*
* @param array $input
* @return string
*/
private function buildQueryString(array $input)
{
$q = [];
foreach ($input as $key => $val) {
$q[] = $key . '=' . $val;
}
return implode('&', $q);
}
/**
* Retry logic for signBlob
*
* @param callable $signBlobFn A callable that perform the actual signBlob operation.
* @param string $resourceName The resource name for logging or retry strategy determination.
* @param array $args Arguments for the operations, include preconditions
* @return string The signature genarated by signBlob.
* @throws ServiceException If non-retryable error occur.
* @throws \RuntimeException If retries are exhausted.
*/
private function retrySignBlob(callable $signBlobFn, string $resourceName = 'signBlob', array $args = [])
{
$attempt = 0;
// Generate a retry decider function using the RetryTrait logic.
$retryDecider = $this->getRestRetryFunction($resourceName, 'execute', $args);
while (true) {
++$attempt;
try {
// Attempt the operation
return $signBlobFn();
} catch (\Exception $exception) {
if (!$retryDecider($exception, $attempt, self::MAX_RETRIES)) {
// Non-retryable error
throw $exception;
}
}
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/StorageClient.php
================================================
$creds]);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* @type string $keyFilePath [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* $creds = new StorageClient(['credentialsFetcher' => $creds]);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* @type float $requestTimeout Seconds to wait before timing out the
* request. **Defaults to** `0` with REST and `60` with gRPC.
* @type int $retries Number of retries for a failed request.
* **Defaults to** `3`.
* @type string $retryStrategy Retry strategy to signify that we never
* want to retry an operation even if the error is retryable.
* **Defaults to** `StorageClient::RETRY_IDEMPOTENT`.
* @type callable $restDelayFunction Executes a delay, defaults to
* utilizing `usleep`. Function signature should match:
* `function (int $delay) : void`.
* @type callable $restCalcDelayFunction Sets the conditions for
* determining how long to wait between attempts to retry. Function
* signature should match: `function (int $attempt) : int`.
* @type callable $restRetryFunction Sets the conditions for whether or
* not a request should attempt to retry. Function signature should
* match: `function (\Exception $ex) : bool`.
* @type callable $restRetryListener Runs after the restRetryFunction.
* This might be used to simply consume the exception and
* $arguments b/w retries. This returns the new $arguments thus
* allowing modification on demand for $arguments. For ex:
* changing the headers in b/w retries.
* @type array $scopes Scopes to be used for the request.
* @type string $quotaProject Specifies a user project to bill for
* access charges associated with the request.
* }
*/
public function __construct(array $config = [])
{
if (!isset($config['scopes'])) {
$config['scopes'] = [
'https://www.googleapis.com/auth/iam',
self::FULL_CONTROL_SCOPE,
];
}
$this->connection = new Rest($this->configureAuthentication($config) + [
'projectId' => $this->projectId
]);
}
/**
* Lazily instantiates a bucket.
*
* There are no network requests made at this point. To see the operations
* that can be performed on a bucket please see {@see Bucket}.
*
* If `$userProject` is set to true, the current project ID (used to
* instantiate the client) will be billed for all requests. If
* `$userProject` is a project ID, given as a string, that project
* will be billed for all requests. This only has an effect when the bucket
* is not owned by the current or given project ID.
*
* Example:
* ```
* $bucket = $storage->bucket('my-bucket');
* ```
*
* @param string $name The name of the bucket to request.
* @param string|bool $userProject If true, the current Project ID
* will be used. If a string, that string will be used as the
* userProject argument, and that project will be billed for the
* request. **Defaults to** `false`.
* @param array $options [optional] {
* Configuration Options.
*
* @type bool $softDeleted If set to true, only soft-deleted bucket versions
* are listed as distinct results in order of bucket name and generation
* number. The default value is false.
* @type string $generation If present, selects a specific soft-deleted version
* of this bucket instead of the live version. This parameter is required if
* softDeleted is set to true.
* }
* @return Bucket
*/
public function bucket($name, $userProject = false, array $options = [])
{
if (!$userProject) {
$userProject = null;
} elseif (!is_string($userProject)) {
$userProject = $this->projectId;
}
return new Bucket($this->connection, $name, $options + [
'requesterProjectId' => $userProject
]);
}
/**
* Fetches all buckets in the project.
*
* Example:
* ```
* $buckets = $storage->buckets();
* ```
*
* ```
* // Get all buckets beginning with the prefix 'album'.
* $buckets = $storage->buckets([
* 'prefix' => 'album'
* ]);
*
* foreach ($buckets as $bucket) {
* echo $bucket->name() . PHP_EOL;
* }
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/buckets/list Buckets list API documentation.
*
* @param array $options [optional] {
* Configuration options.
*
* @type int $maxResults Maximum number of results to return per
* requested page.
* @type int $resultLimit Limit the number of results returned in total.
* **Defaults to** `0` (return all results).
* @type string $pageToken A previously-returned page token used to
* resume the loading of results from a specific point.
* @type string $prefix Filter results with this prefix.
* @type string $projection Determines which properties to return. May
* be either 'full' or 'noAcl'.
* @type string $fields Selector which will cause the response to only
* return the specified fields.
* @type string $userProject If set, this is the ID of the project which
* will be billed for the request.
* @type bool $softDeleted If set to true, only soft-deleted bucket versions
* are listed as distinct results in order of bucket name and generation
* number. The default value is false.
* @type bool $bucketUserProject If true, each returned instance will
* have `$userProject` set to the value of `$options.userProject`.
* If false, `$options.userProject` will be used ONLY for the
* listBuckets operation. If `$options.userProject` is not set,
* this option has no effect. **Defaults to** `true`.
* @type bool $returnPartialSuccess If true, the returned iterator will contain an
* `unreachable` property with a list of buckets that were not retrieved.
* **Note:** If set to false (default) and unreachable buckets are found,
* the operation will throw an exception.
*
* }
* @return BucketIterator
* @throws GoogleException When a project ID has not been detected.
*/
public function buckets(array $options = [])
{
$this->requireProjectId();
$resultLimit = $this->pluck('resultLimit', $options, false);
$bucketUserProject = $this->pluck('bucketUserProject', $options, null) ?? true;
$userProject = $bucketUserProject ? ($options['userProject'] ?? null) : null;
$unreachable = new \ArrayObject();
$apiCall = [$this->connection, 'listBuckets'];
$callDelegate = function (array $args) use ($apiCall, $unreachable) {
$response = call_user_func($apiCall, $args);
if (isset($response['unreachable']) && is_array($response['unreachable'])) {
$current = $unreachable->getArrayCopy();
$updated = array_unique(array_merge($current, $response['unreachable']));
$unreachable->exchangeArray($updated);
}
return $response;
};
// Return the new BucketIterator with the wrapped unreachable bucket
return new BucketIterator(
new PageIterator(
function (array $bucket) use ($userProject) {
return new Bucket(
$this->connection,
$bucket['name'],
$bucket + ['requesterProjectId' => $userProject]
);
},
$callDelegate,
$options + ['project' => $this->projectId],
['resultLimit' => $resultLimit]
),
$unreachable
);
}
/**
* Restores a soft-deleted bucket.
*
* Example:
* ```
* $bucket = $storage->bucket->restore('my-bucket');
* ```
*
* @param string $name The name of the bucket to restore.
* @param string $generation The specific version of the bucket to be restored.
* @param array $options [optional] {
* Configuration Options.
*
* @type string $projection Determines which properties to return. May
* be either `"full"` or `"noAcl"`. **Defaults to** `"noAcl"`,
* unless the bucket resource specifies acl or defaultObjectAcl
* properties, when it defaults to `"full"`.
* }
* @return Bucket
*/
public function restore(string $name, string $generation, array $options = [])
{
$res = $this->connection->restoreBucket([
'bucket' => $name,
'generation' => $generation,
] + $options);
return new Bucket(
$this->connection,
$name
);
}
/**
* Create a bucket. Bucket names must be unique as Cloud Storage uses a flat
* namespace. For more information please see
* [bucket name requirements](https://cloud.google.com/storage/docs/naming#requirements)
*
* Example:
* ```
* $bucket = $storage->createBucket('bucket');
* ```
*
* ```
* // Create a bucket with logging enabled.
* $bucket = $storage->createBucket('myBeautifulBucket', [
* 'logging' => [
* 'logBucket' => 'bucketToLogTo',
* 'logObjectPrefix' => 'myPrefix'
* ]
* ]);
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/buckets/insert Buckets insert API documentation.
*
* @param string $name Name of the bucket to be created.
* @codingStandardsIgnoreStart
* @param array $options [optional] {
* Configuration options.
*
* @type string $predefinedAcl Predefined ACL to apply to the bucket.
* Acceptable values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type string $predefinedDefaultObjectAcl Apply a predefined set of
* default object access controls to this bucket.
* @type bool $enableObjectRetention Whether object retention should
* be enabled on this bucket. For more information, refer to the
* [Object Retention Lock](https://cloud.google.com/storage/docs/object-lock)
* documentation.
* @type string $projection Determines which properties to return. May
* be either `"full"` or `"noAcl"`. **Defaults to** `"noAcl"`,
* unless the bucket resource specifies acl or defaultObjectAcl
* properties, when it defaults to `"full"`.
* @type string $fields Selector which will cause the response to only
* return the specified fields.
* @type array $acl Access controls on the bucket.
* @type array $cors The bucket's Cross-Origin Resource Sharing (CORS)
* configuration.
* @type array $defaultObjectAcl Default access controls to apply to new
* objects when no ACL is provided.
* @type array|Lifecycle $lifecycle The bucket's lifecycle configuration.
* @type string $location The location of the bucket. If specifying
* a dual-region, the `customPlacementConfig` property should be
* set in conjunction. For more information, see
* [Bucket Locations](https://cloud.google.com/storage/docs/locations).
* **Defaults to** `"US"`.
* @type array $hierarchicalNamespace The hierarchical namespace configuration
* on this bucket.
* @type array $customPlacementConfig The bucket's dual regions. For more
* information, see
* [Bucket Locations](https://cloud.google.com/storage/docs/locations).
* @type array $logging The bucket's logging configuration, which
* defines the destination bucket and optional name prefix for the
* current bucket's logs.
* @type string $storageClass The bucket's storage class. This defines
* how objects in the bucket are stored and determines the SLA and
* the cost of storage. Acceptable values include the following
* strings: `"STANDARD"`, `"NEARLINE"`, `"COLDLINE"` and
* `"ARCHIVE"`. Legacy values including `"MULTI_REGIONAL"`,
* `"REGIONAL"` and `"DURABLE_REDUCED_AVAILABILITY"` are also
* available, but should be avoided for new implementations. For
* more information, refer to the
* [Storage Classes](https://cloud.google.com/storage/docs/storage-classes)
* documentation. **Defaults to** `"STANDARD"`.
* @type array $autoclass The bucket's autoclass configuration.
* Buckets can have either StorageClass OLM rules or Autoclass,
* but not both. When Autoclass is enabled on a bucket, adding
* StorageClass OLM rules will result in failure.
* For more information, refer to
* [Storage Autoclass](https://cloud.google.com/storage/docs/autoclass)
* @type array $versioning The bucket's versioning configuration.
* @type array $website The bucket's website configuration.
* @type array $billing The bucket's billing configuration.
* @type bool $billing.requesterPays When `true`, requests to this bucket
* and objects within it must provide a project ID to which the
* request will be billed.
* @type array $labels The Bucket labels. Labels are represented as an
* array of keys and values. To remove an existing label, set its
* value to `null`.
* @type string $userProject If set, this is the ID of the project which
* will be billed for the request.
* @type bool $bucketUserProject If true, the returned instance will
* have `$userProject` set to the value of `$options.userProject`.
* If false, `$options.userProject` will be used ONLY for the
* createBucket operation. If `$options.userProject` is not set,
* this option has no effect. **Defaults to** `true`.
* @type array $encryption Encryption configuration used by default for
* newly inserted objects.
* @type string $encryption.defaultKmsKeyName A Cloud KMS Key used to
* encrypt objects uploaded into this bucket. Should be in the
* format
* `projects/my-project/locations/kr-location/keyRings/my-kr/cryptoKeys/my-key`.
* Please note the KMS key ring must use the same location as the
* bucket.
* @type bool $defaultEventBasedHold When `true`, newly created objects
* in this bucket will be retained indefinitely until an event
* occurs, signified by the hold's release.
* @type array $retentionPolicy Defines the retention policy for a
* bucket. In order to lock a retention policy, please see
* {@see Bucket::lockRetentionPolicy()}.
* @type int $retentionPolicy.retentionPeriod Specifies the retention
* period for objects in seconds. During the retention period an
* object cannot be overwritten or deleted. Retention period must
* be greater than zero and less than 100 years.
* @type array $iamConfiguration The bucket's IAM configuration.
* @type bool $iamConfiguration.bucketPolicyOnly.enabled this is an alias
* for $iamConfiguration.uniformBucketLevelAccess.
* @type bool $iamConfiguration.uniformBucketLevelAccess.enabled If set and
* true, access checks only use bucket-level IAM policies or
* above. When enabled, requests attempting to view or manipulate
* ACLs will fail with error code 400. **NOTE**: Before using
* Uniform bucket-level access, please review the
* [feature documentation](https://cloud.google.com/storage/docs/uniform-bucket-level-access),
* as well as
* [Should You Use uniform bucket-level access](https://cloud.google.com/storage/docs/uniform-bucket-level-access#should-you-use)
* @type string $rpo Specifies the Turbo Replication setting for a dual-region bucket.
* The possible values are DEFAULT and ASYNC_TURBO. Trying to set the rpo for a non dual-region
* bucket will throw an exception. Non existence of this parameter is equivalent to it being DEFAULT.
* }
* @codingStandardsIgnoreEnd
* @return Bucket
* @throws GoogleException When a project ID has not been detected.
*/
public function createBucket($name, array $options = [])
{
$this->requireProjectId();
if (isset($options['lifecycle']) && $options['lifecycle'] instanceof Lifecycle) {
$options['lifecycle'] = $options['lifecycle']->toArray();
}
$bucketUserProject = $this->pluck('bucketUserProject', $options, false);
$bucketUserProject = !is_null($bucketUserProject)
? $bucketUserProject
: true;
$userProject = (isset($options['userProject']) && $bucketUserProject)
? $options['userProject']
: null;
$response = $this->connection->insertBucket($options + ['name' => $name, 'project' => $this->projectId]);
return new Bucket(
$this->connection,
$name,
$response + ['requesterProjectId' => $userProject]
);
}
/**
* Registers this StorageClient as the handler for stream reading/writing.
*
* @param string $protocol The name of the protocol to use. **Defaults to** `gs`.
* @throws \RuntimeException
*/
public function registerStreamWrapper($protocol = null)
{
return StreamWrapper::register($this, $protocol);
}
/**
* Unregisters the SteamWrapper
*
* @param string $protocol The name of the protocol to unregister. **Defaults to** `gs`.
*/
public function unregisterStreamWrapper($protocol = null)
{
StreamWrapper::unregister($protocol);
}
/**
* Create an uploader to handle a Signed URL.
*
* Example:
* ```
* $uploader = $storage->signedUrlUploader($uri, fopen('/path/to/myfile.doc', 'r'));
* ```
*
* @param string $uri The URI to accept an upload request.
* @param string|resource|StreamInterface $data The data to be uploaded
* @param array $options [optional] Configuration Options. Refer to
* {@see \Google\Cloud\Core\Upload\AbstractUploader::__construct()}.
* @return SignedUrlUploader
*/
public function signedUrlUploader($uri, $data, array $options = [])
{
return new SignedUrlUploader($this->connection->requestWrapper(), $data, $uri, $options);
}
/**
* Create a Timestamp object.
*
* Example:
* ```
* $timestamp = $storage->timestamp(new \DateTime('2003-02-05 11:15:02.421827Z'));
* ```
*
* @param \DateTimeInterface $timestamp The timestamp value.
* @param int $nanoSeconds [optional] The number of nanoseconds in the timestamp.
* @return Timestamp
*/
public function timestamp(\DateTimeInterface $timestamp, $nanoSeconds = null)
{
return new Timestamp($timestamp, $nanoSeconds);
}
/**
* Get the service account email associated with this client.
*
* Example:
* ```
* $serviceAccount = $storage->getServiceAccount();
* ```
*
* @param array $options [optional] {
* Configuration options.
*
* @type string $userProject If set, this is the ID of the project which
* will be billed for the request.
* }
* @return string
*/
public function getServiceAccount(array $options = [])
{
$resp = $this->connection->getServiceAccount($options + ['projectId' => $this->projectId]);
return $resp['email_address'];
}
/**
* List Service Account HMAC keys in the project.
*
* Example:
* ```
* $hmacKeys = $storage->hmacKeys();
* ```
*
* ```
* // Get the HMAC keys associated with a Service Account email
* $hmacKeys = $storage->hmacKeys([
* 'serviceAccountEmail' => $serviceAccountEmail
* ]);
* ```
*
* @param array $options {
* Configuration Options
*
* @type string $serviceAccountEmail If present, only keys for the given
* service account are returned.
* @type bool $showDeletedKeys Whether or not to show keys in the
* DELETED state.
* @type string $userProject If set, this is the ID of the project which
* will be billed for the request.
* @type string $projectId The project ID to use, if different from that
* with which the client was created.
* }
* @return ItemIterator
*/
public function hmacKeys(array $options = [])
{
$options += [
'projectId' => $this->projectId
];
if (!$options['projectId']) {
$this->requireProjectId();
}
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function (array $metadata) use ($options) {
return $this->hmacKey(
$metadata['accessId'],
$options['projectId'],
$metadata
);
},
[$this->connection, 'listHmacKeys'],
$options,
['resultLimit' => $resultLimit]
)
);
}
/**
* Lazily instantiate an HMAC Key instance using an Access ID.
*
* Example:
* ```
* $hmacKey = $storage->hmacKey($accessId);
* ```
*
* @param string $accessId The ID of the HMAC Key.
* @param string $projectId [optional] The project ID to use, if different
* from that with which the client was created.
* @param array $metadata [optional] HMAC key metadata.
* @return HmacKey
*/
public function hmacKey($accessId, $projectId = null, array $metadata = [])
{
if (!$projectId) {
$this->requireProjectId();
}
return new HmacKey($this->connection, $projectId ?: $this->projectId, $accessId, $metadata);
}
/**
* Creates a new HMAC key for the specified service account.
*
* Please note that the HMAC secret is only available at creation. Make sure
* to note the secret after creation.
*
* Example:
* ```
* $response = $storage->createHmacKey('account@myProject.iam.gserviceaccount.com');
* $secret = $response->secret();
* ```
*
* @param string $serviceAccountEmail Email address of the service account.
* @param array $options {
* Configuration Options
*
* @type string $userProject If set, this is the ID of the project which
* will be billed for the request. **NOTE**: This option is
* currently ignored by Cloud Storage.
* @type string $projectId The project ID to use, if different from that
* with which the client was created.
* }
* @return CreatedHmacKey
*/
public function createHmacKey($serviceAccountEmail, array $options = [])
{
$options += [
'projectId' => $this->projectId
];
if (!$options['projectId']) {
$this->requireProjectId();
}
$res = $this->connection->createHmacKey([
'projectId' => $options['projectId'],
'serviceAccountEmail' => $serviceAccountEmail
] + $options);
$key = new HmacKey(
$this->connection,
$options['projectId'],
$res['metadata']['accessId'],
$res['metadata']
);
return new CreatedHmacKey($key, $res['secret']);
}
/**
* Throw an exception if no project ID available.
*
* @return void
* @throws GoogleException
*/
private function requireProjectId()
{
if (!$this->projectId) {
throw new GoogleException(
'No project ID was provided, ' .
'and we were unable to detect a default project ID.'
);
}
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/StorageObject.php
================================================
bucket('my-bucket');
* $object = $bucket->object('my-object');
* ```
*/
class StorageObject
{
use ArrayTrait;
use EncryptionTrait;
/**
* @deprecated
*/
const DEFAULT_DOWNLOAD_URL = SigningHelper::DEFAULT_DOWNLOAD_HOST;
/**
* @var Acl ACL for the object.
*/
private $acl;
/**
* @var ConnectionInterface Represents a connection to Cloud Storage.
* @internal
*/
protected $connection;
/**
* @var array|null The object's encryption data.
*/
private $encryptionData;
/**
* @var array The object's identity.
*/
private $identity;
/**
* @var array|null The object's metadata.
*/
private $info;
/**
* @param ConnectionInterface $connection Represents a connection to Cloud
* Storage. This object is created by StorageClient,
* and should not be instantiated outside of this client.
* @param string $name The object's name.
* @param string $bucket The name of the bucket the object is contained in.
* @param string $generation [optional] The generation of the object.
* @param array $info [optional] The object's metadata.
* @param string $encryptionKey [optional] An AES-256 customer-supplied
* encryption key.
* @param string $encryptionKeySHA256 [optional] The SHA256 hash of the
* customer-supplied encryption key.
*/
public function __construct(
ConnectionInterface $connection,
$name,
$bucket,
$generation = null,
array $info = [],
$encryptionKey = null,
$encryptionKeySHA256 = null
) {
$this->connection = $connection;
$this->info = $info;
$this->encryptionData = [
'encryptionKey' => $encryptionKey,
'encryptionKeySHA256' => $encryptionKeySHA256
];
$this->identity = [
'bucket' => $bucket,
'object' => $name,
'generation' => $generation,
'userProject' => $this->pluck('requesterProjectId', $info, false)
];
$this->acl = new Acl($this->connection, 'objectAccessControls', $this->identity);
}
/**
* Configure ACL for this object.
*
* Example:
* ```
* $acl = $object->acl();
* ```
*
* @see https://cloud.google.com/storage/docs/access-control More about Access Control Lists
*
* @return Acl
*/
public function acl()
{
return $this->acl;
}
/**
* Check whether or not the object exists.
*
* Example:
* ```
* if ($object->exists()) {
* echo 'Object exists!';
* }
* ```
*
* @param array $options [optional] Configuration options.
* @return bool
*/
public function exists(array $options = [])
{
try {
$this->connection->getObject($this->identity + $options + ['fields' => 'name']);
} catch (NotFoundException $ex) {
return false;
}
return true;
}
/**
* Delete the object.
*
* Example:
* ```
* $object->delete();
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/delete Objects delete API documentation.
*
* @param array $options [optional] {
* Configuration options.
*
* @type string $ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given
* value.
* @type string $ifGenerationNotMatch Makes the operation conditional on
* whether the object's current generation does not match the
* given value.
* @type string $ifMetagenerationMatch Makes the operation conditional
* on whether the object's current metageneration matches the
* given value.
* @type string $ifMetagenerationNotMatch Makes the operation
* conditional on whether the object's current metageneration does
* not match the given value.
* }
* @return void
*/
public function delete(array $options = [])
{
$this->connection->deleteObject($options + array_filter($this->identity));
}
/**
* Update the object. Upon receiving a result the local object's data will
* be updated.
*
* Example:
* ```
* // Add custom metadata to an existing object.
* $object->update([
* 'metadata' => [
* 'albumType' => 'family'
* ]
* ]);
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/patch Objects patch API documentation.
*
* @param array $metadata The available options for metadata are outlined
* at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects#resource)
* @param array $options [optional] {
* Configuration options.
*
* @type string $ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given
* value.
* @type string $ifGenerationNotMatch Makes the operation conditional on
* whether the object's current generation does not match the
* given value.
* @type string $ifMetagenerationMatch Makes the operation conditional
* on whether the object's current metageneration matches the
* given value.
* @type string $ifMetagenerationNotMatch Makes the operation
* conditional on whether the object's current metageneration does
* not match the given value.
* @type string $predefinedAcl Predefined ACL to apply to the object.
* Acceptable values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type array $retention The full list of available options are outlined
* at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/update#request-body).
* @type string $retention.retainUntilTime The earliest time in RFC 3339
* UTC "Zulu" format that the object can be deleted or replaced.
* This is the retention configuration set for this object.
* @type string $retention.mode The mode of the retention configuration,
* which can be either `"Unlocked"` or `"Locked"`.
* @type bool $overrideUnlockedRetention Applicable for objects that
* have an unlocked retention configuration. Required to be set to
* `true` if the operation includes a retention property that
* changes the mode to `Locked`, reduces the `retainUntilTime`, or
* removes the retention configuration from the object.
* @type string $projection Determines which properties to return. May
* be either 'full' or 'noAcl'.
* @type string $fields Selector which will cause the response to only
* return the specified fields.
* }
* @return array
*/
public function update(array $metadata, array $options = [])
{
$options += $metadata;
// can only set predefinedAcl or acl
if (isset($options['predefinedAcl'])) {
$options['acl'] = null;
}
return $this->info = $this->connection->patchObject($options + array_filter($this->identity));
}
/**
* Copy the object to a destination bucket.
*
* Please note that if the destination bucket is the same as the source
* bucket and a new name is not provided the source object will be replaced
* with the copy of itself.
*
* Example:
* ```
* // Provide your destination bucket as a string and retain the source
* // object's name.
* $copiedObject = $object->copy('otherBucket');
* ```
*
* ```
* // Provide your destination bucket as a bucket object and choose a new
* // name for the copied object.
* $otherBucket = $storage->bucket('otherBucket');
* $copiedObject = $object->copy($otherBucket, [
* 'name' => 'newFile.txt'
* ]);
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/copy Objects copy API documentation.
*
* @param Bucket|string $destination The destination bucket.
* @param array $options [optional] {
* Configuration options.
*
* @type string $name The name of the destination object. **Defaults
* to** the name of the source object.
* @type string $predefinedAcl Predefined ACL to apply to the object.
* Acceptable values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type string $encryptionKey A base64 encoded AES-256 customer-supplied
* encryption key. It will be neccesary to provide this when a key
* was used during the object's creation.
* @type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
* customer-supplied encryption key. This value will be calculated
* from the `encryptionKey` on your behalf if not provided, but
* for best performance it is recommended to pass in a cached
* version of the already calculated SHA.
* @type string $ifGenerationMatch Makes the operation conditional on
* whether the destination object's current generation matches the
* given value.
* @type string $ifGenerationNotMatch Makes the operation conditional on
* whether the destination object's current generation does not
* match the given value.
* @type string $ifMetagenerationMatch Makes the operation conditional
* on whether the destination object's current metageneration
* matches the given value.
* @type string $ifMetagenerationNotMatch Makes the operation
* conditional on whether the destination object's current
* metageneration does not match the given value.
* @type string $ifSourceGenerationMatch Makes the operation conditional
* on whether the source object's current generation matches the
* given value.
* @type string $ifSourceGenerationNotMatch Makes the operation
* conditional on whether the source object's current generation
* does not match the given value.
* @type string $ifSourceMetagenerationMatch Makes the operation
* conditional on whether the source object's current
* metageneration matches the given value.
* @type string $ifSourceMetagenerationNotMatch Makes the operation
* conditional on whether the source object's current
* metageneration does not match the given value.
* }
* @return StorageObject
*/
public function copy($destination, array $options = [])
{
$key = $options['encryptionKey'] ?? null;
$keySHA256 = $options['encryptionKeySHA256'] ?? null;
$response = $this->connection->copyObject(
$this->formatDestinationRequest($destination, $options)
);
return new StorageObject(
$this->connection,
$response['name'],
$response['bucket'],
$response['generation'],
$response + ['requesterProjectId' => $this->identity['userProject']],
$key,
$keySHA256
);
}
/**
* Rewrite the object to a destination bucket.
*
* This method copies data using multiple requests so large objects can be
* copied with a normal length timeout per request rather than one very long
* timeout for a single request.
*
* Please note that if the destination bucket is the same as the source
* bucket and a new name is not provided the source object will be replaced
* with the copy of itself.
*
* Example:
* ```
* // Provide your destination bucket as a string and retain the source
* // object's name.
* $rewrittenObject = $object->rewrite('otherBucket');
* ```
*
* ```
* // Provide your destination bucket as a bucket object and choose a new
* // name for the copied object.
* $otherBucket = $storage->bucket('otherBucket');
* $rewrittenObject = $object->rewrite($otherBucket, [
* 'name' => 'newFile.txt'
* ]);
* ```
*
* ```
* // Rotate customer-supplied encryption keys.
* $key = file_get_contents(__DIR__ . '/key.txt');
* $destinationKey = base64_encode(openssl_random_pseudo_bytes(32)); // Make sure to remember your key.
*
* $rewrittenObject = $object->rewrite('otherBucket', [
* 'encryptionKey' => $key,
* 'destinationEncryptionKey' => $destinationKey
* ]);
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite Objects rewrite API documentation.
* @see https://cloud.google.com/storage/docs/encryption#customer-supplied Customer-supplied encryption keys.
*
* @param Bucket|string $destination The destination bucket.
* @param array $options [optional] {
* Configuration options.
*
* @type string $name The name of the destination object. **Defaults
* to** the name of the source object.
* @type string $predefinedAcl Predefined ACL to apply to the object.
* Acceptable values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type string $maxBytesRewrittenPerCall The maximum number of bytes
* that will be rewritten per rewrite request. Most callers
* shouldn't need to specify this parameter - it is primarily in
* place to support testing. If specified the value must be an
* integral multiple of 1 MiB (1048576). Also, this only applies
* to requests where the source and destination span locations
* and/or storage classes.
* @type string $encryptionKey A base64 encoded AES-256 customer-supplied
* encryption key. It will be neccesary to provide this when a key
* was used during the object's creation.
* @type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
* customer-supplied encryption key. This value will be calculated
* from the `encryptionKey` on your behalf if not provided, but
* for best performance it is recommended to pass in a cached
* version of the already calculated SHA.
* @type string $destinationEncryptionKey A base64 encoded AES-256
* customer-supplied encryption key that will be used to encrypt
* the rewritten object.
* @type string $destinationEncryptionKeySHA256 Base64 encoded SHA256
* hash of the customer-supplied destination encryption key. This
* value will be calculated from the `destinationEncryptionKey` on
* your behalf if not provided, but for best performance it is
* recommended to pass in a cached version of the already
* calculated SHA.
* @type string $destinationKmsKeyName Name of the Cloud KMS key that
* will be used to encrypt the object. Should be in the format
* `projects/my-project/locations/kr-location/keyRings/my-kr/cryptoKeys/my-key`.
* Please note the KMS key ring must use the same location as the
* destination bucket.
* @type string $ifGenerationMatch Makes the operation conditional on
* whether the destination object's current generation matches the
* given value.
* @type string $ifGenerationNotMatch Makes the operation conditional on
* whether the destination object's current generation does not
* match the given value.
* @type string $ifMetagenerationMatch Makes the operation conditional
* on whether the destination object's current metageneration
* matches the given value.
* @type string $ifMetagenerationNotMatch Makes the operation
* conditional on whether the destination object's current
* metageneration does not match the given value.
* @type string $ifSourceGenerationMatch Makes the operation conditional
* on whether the source object's current generation matches the
* given value.
* @type string $ifSourceGenerationNotMatch Makes the operation
* conditional on whether the source object's current generation
* does not match the given value.
* @type string $ifSourceMetagenerationMatch Makes the operation
* conditional on whether the source object's current
* metageneration matches the given value.
* @type string $ifSourceMetagenerationNotMatch Makes the operation
* conditional on whether the source object's current
* metageneration does not match the given value.
* }
* @return StorageObject
* @throws \InvalidArgumentException
*/
public function rewrite($destination, array $options = [])
{
$options['useCopySourceHeaders'] = true;
$destinationKey = $options['destinationEncryptionKey'] ?? null;
$destinationKeySHA256 = $options['destinationEncryptionKeySHA256'] ?? null;
$options = $this->formatDestinationRequest($destination, $options);
do {
$response = $this->connection->rewriteObject($options);
$options['rewriteToken'] = $response['rewriteToken'] ?? null;
} while ($options['rewriteToken']);
return new StorageObject(
$this->connection,
$response['resource']['name'],
$response['resource']['bucket'],
$response['resource']['generation'],
$response['resource'] + ['requesterProjectId' => $this->identity['userProject']],
$destinationKey,
$destinationKeySHA256
);
}
/**
* Move an object within a bucket.
*
* This method copies data using multiple requests so large objects can be
* copied with a normal length timeout per request rather than one very long
* timeout for a single request.
*
* Example:
* ```
* // Provide your destination object as a string.
* $moveObject = $object->move('newObject.txt');
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/move Objects move API documentation.
*
* @param string $destinationObject The destination object.
* @param array $options [optional]
* Configuration options.
*
* @type string $ifGenerationMatch Makes the operation conditional on
* whether the destination object's current generation matches the
* given value.
* @type string $ifGenerationNotMatch Makes the operation conditional on
* whether the destination object's current generation does not
* match the given value.
* @type string $ifMetagenerationMatch Makes the operation conditional
* on whether the destination object's current metageneration
* matches the given value.
* @type string $ifMetagenerationNotMatch Makes the operation
* conditional on whether the destination object's current
* metageneration does not match the given value.
* @type string $ifSourceGenerationMatch Makes the operation conditional
* on whether the source object's current generation matches the
* given value.
* @type string $ifSourceGenerationNotMatch Makes the operation
* conditional on whether the source object's current generation
* does not match the given value.
* @type string $ifSourceMetagenerationMatch Makes the operation
* conditional on whether the source object's current
* metageneration matches the given value.
* @type string $ifSourceMetagenerationNotMatch Makes the operation
* conditional on whether the source object's current
* metageneration does not match the given value.
*
* @return StorageObject
* @throws \InvalidArgumentException
*/
public function move($destinationObject, array $options = [])
{
if (!is_string($destinationObject)) {
throw new \InvalidArgumentException(
'$destinationObject must be a string.'
);
}
$options['bucket'] = $this->identity['bucket'];
$options['sourceObject'] = $this->identity['object'];
$options['destinationObject'] = $destinationObject;
$options['userProject'] = $this->identity['userProject'];
$response = $this->connection->moveObject($options);
return new StorageObject(
$this->connection,
$response['name'],
$response['bucket'],
$response['generation'],
$response + ['requesterProjectId' => $this->identity['userProject']]
);
}
/**
* Renames the object.
*
* Please note that there is no atomic rename provided by the Storage API.
* This method is for convenience and is a set of sequential calls to copy
* and delete. Upon success the source object's metadata will be cleared,
* please use the returned object instead.
*
* Example:
* ```
* $object2 = $object->rename('object2.txt');
* echo $object2->name();
* ```
*
* @param string $name The new name.
* @param array $options [optional] {
* Configuration options.
*
* @type string $predefinedAcl Predefined ACL to apply to the object.
* Acceptable values include, `"authenticatedRead"`,
* `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
* `"projectPrivate"`, and `"publicRead"`.
* @type string $encryptionKey A base64 encoded AES-256 customer-supplied
* encryption key. It will be neccesary to provide this when a key
* was used during the object's creation.
* @type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
* customer-supplied encryption key. This value will be calculated
* from the `encryptionKey` on your behalf if not provided, but
* for best performance it is recommended to pass in a cached
* version of the already calculated SHA.
* @type string $ifGenerationMatch Makes the operation conditional on
* whether the destination object's current generation matches the
* given value.
* @type string $ifGenerationNotMatch Makes the operation conditional on
* whether the destination object's current generation does not
* match the given value.
* @type string $ifMetagenerationMatch Makes the operation conditional
* on whether the destination object's current metageneration
* matches the given value.
* @type string $ifMetagenerationNotMatch Makes the operation
* conditional on whether the destination object's current
* metageneration does not match the given value.
* @type string $ifSourceGenerationMatch Makes the operation conditional
* on whether the source object's current generation matches the
* given value.
* @type string $ifSourceGenerationNotMatch Makes the operation
* conditional on whether the source object's current generation
* does not match the given value.
* @type string $ifSourceMetagenerationMatch Makes the operation
* conditional on whether the source object's current
* metageneration matches the given value.
* @type string $ifSourceMetagenerationNotMatch Makes the operation
* conditional on whether the source object's current
* metageneration does not match the given value.
* @type string $destinationBucket Will move to this bucket if set. If
* not set, will default to the same bucket.
* }
* @return StorageObject The renamed object.
*/
public function rename($name, array $options = [])
{
$destinationBucket = $options['destinationBucket'] ?? $this->identity['bucket'];
unset($options['destinationBucket']);
$copiedObject = $this->copy($destinationBucket, [
'name' => $name
] + $options);
$this->delete(
array_intersect_key($options, [
'restOptions' => null,
'retries' => null
])
);
$this->info = [];
return $copiedObject;
}
/**
* Download an object as a string.
*
* For an example of setting the range header to download a subrange of the
* object please see {@see StorageObject::downloadAsStream()}.
*
* Example:
* ```
* $string = $object->downloadAsString();
* echo $string;
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/get Objects get API documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/parameters#range Learn more about the Range header.
*
* @param array $options [optional] {
* Configuration Options.
*
* @type string $encryptionKey An AES-256 customer-supplied encryption
* key. It will be neccesary to provide this when a key was used
* during the object's creation. If provided one must also include
* an `encryptionKeySHA256`.
* @type string $encryptionKeySHA256 The SHA256 hash of the
* customer-supplied encryption key. It will be neccesary to
* provide this when a key was used during the object's creation.
* If provided one must also include an `encryptionKey`.
* }
* @return string
*/
public function downloadAsString(array $options = [])
{
return (string) $this->downloadAsStream($options);
}
/**
* Download an object to a specified location.
*
* For an example of setting the range header to download a subrange of the
* object please see {@see StorageObject::downloadAsStream()}.
*
* Example:
* ```
* $stream = $object->downloadToFile(__DIR__ . '/my-file.txt');
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/get Objects get API documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/parameters#range Learn more about the Range header.
*
* @param string $path Path to download the file to.
* @param array $options [optional] {
* Configuration Options.
*
* @type string $encryptionKey An AES-256 customer-supplied encryption
* key. It will be neccesary to provide this when a key was used
* during the object's creation. If provided one must also include
* an `encryptionKeySHA256`.
* @type string $encryptionKeySHA256 The SHA256 hash of the
* customer-supplied encryption key. It will be neccesary to
* provide this when a key was used during the object's creation.
* If provided one must also include an `encryptionKey`.
* }
* @return StreamInterface
*/
public function downloadToFile($path, array $options = [])
{
$source = $this->downloadAsStream($options);
$destination = Utils::streamFor(fopen($path, 'w'));
Utils::copyToStream(
$source,
$destination
);
$destination->seek(0);
return $destination;
}
/**
* Download an object as a stream. The library will attempt to resume the download
* if a retry-able error is thrown. An attempt to fetch the remaining file will
* be made only if the user has not supplied a custom retry
* function of their own.
*
* Please note Google Cloud Storage respects the Range header as specified
* by [RFC7233](https://tools.ietf.org/html/rfc7233#section-3.1). See below
* for an example of this in action.
*
* Example:
* ```
* $stream = $object->downloadAsStream();
* echo $stream->getContents();
* ```
*
* ```
* // Set the Range header in order to download a subrange of the object. For more examples of
* // setting the Range header, please see [RFC7233](https://tools.ietf.org/html/rfc7233#section-3.1).
* $firstFiveBytes = '0-4'; // Get the first 5 bytes.
* $fromFifthByteToLastByte = '4-'; // Get the bytes starting with the 5th to the last.
* $lastFiveBytes = '-5'; // Get the last 5 bytes.
*
* $stream = $object->downloadAsStream([
* 'restOptions' => [
* 'headers' => [
* 'Range' => "bytes=$firstFiveBytes"
* ]
* ]
* ]);
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/get Objects get API documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/parameters#range Learn more about the Range header.
*
* @param array $options [optional] {
* Configuration Options.
*
* @type string $encryptionKey An AES-256 customer-supplied encryption
* key. It will be neccesary to provide this when a key was used
* during the object's creation. If provided one must also include
* an `encryptionKeySHA256`.
* @type string $encryptionKeySHA256 The SHA256 hash of the
* customer-supplied encryption key. It will be neccesary to
* provide this when a key was used during the object's creation.
* If provided one must also include an `encryptionKey`.
* }
* @return StreamInterface
*/
public function downloadAsStream(array $options = [])
{
return $this->connection->downloadObject(
$this->formatEncryptionHeaders(
$options
+ $this->encryptionData
+ array_filter($this->identity)
)
);
}
/**
* Asynchronously download an object as a stream.
*
* For an example of setting the range header to download a subrange of the
* object please see {@see StorageObject::downloadAsStream()}.
*
* Example:
* ```
* use Psr\Http\Message\StreamInterface;
*
* $promise = $object->downloadAsStreamAsync()
* ->then(function (StreamInterface $data) {
* echo $data->getContents();
* });
*
* $promise->wait();
* ```
*
* ```
* // Download all objects in a bucket asynchronously.
* use GuzzleHttp\Promise\Utils;
* use Psr\Http\Message\StreamInterface;
*
* $promises = [];
*
* foreach ($bucket->objects() as $object) {
* $promises[] = $object->downloadAsStreamAsync()
* ->then(function (StreamInterface $data) {
* echo $data->getContents();
* });
* }
*
* Utils::unwrap($promises);
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/get Objects get API documentation.
* @see https://cloud.google.com/storage/docs/json_api/v1/parameters#range Learn more about the Range header.
* @see https://github.com/guzzle/promises Learn more about Guzzle Promises
*
* @param array $options [optional] {
* Configuration Options.
*
* @type string $encryptionKey An AES-256 customer-supplied encryption
* key. It will be neccesary to provide this when a key was used
* during the object's creation. If provided one must also include
* an `encryptionKeySHA256`.
* @type string $encryptionKeySHA256 The SHA256 hash of the
* customer-supplied encryption key. It will be neccesary to
* provide this when a key was used during the object's creation.
* If provided one must also include an `encryptionKey`.
* }
* @return PromiseInterface
* @experimental The experimental flag means that while we believe this method
* or class is ready for use, it may change before release in backwards-
* incompatible ways. Please use with caution, and test thoroughly when
* upgrading.
*/
public function downloadAsStreamAsync(array $options = [])
{
return $this->connection->downloadObjectAsync(
$this->formatEncryptionHeaders(
$options
+ $this->encryptionData
+ array_filter($this->identity)
)
);
}
/**
* Create a Signed URL for this object.
*
* Signed URLs can be complex, and it is strongly recommended you read and
* understand the [documentation](https://cloud.google.com/storage/docs/access-control/signed-urls).
*
* In cases where a keyfile is available, signing is accomplished in the
* client using your Service Account private key. In Google Compute Engine,
* signing is accomplished using
* [IAM signBlob](https://cloud.google.com/iam/credentials/reference/rest/v1/projects.serviceAccounts/signBlob).
* Signing using IAM requires that your service account be granted the
* `iam.serviceAccounts.signBlob` permission, part of the "Service Account
* Token Creator" IAM role.
*
* Additionally, signing using IAM requires different scopes. When creating
* an instance of {@see StorageClient}, provide the
* `https://www.googleapis.com/auth/cloud-platform` scopein `$options.scopes`.
* This scope may be used entirely in place of the scopes provided in
* {@see StorageClient}.
*
* App Engine and Compute Engine will attempt to sign URLs using IAM.
*
* Example:
* ```
* $url = $object->signedUrl(new \DateTime('tomorrow'));
* ```
*
* ```
* // Create a signed URL allowing updates to the object.
* $url = $object->signedUrl(new \DateTime('tomorrow'), [
* 'method' => 'PUT'
* ]);
* ```
*
* ```
* // Use Signed URLs v4
* $url = $object->signedUrl(new \DateTime('tomorrow'), [
* 'version' => 'v4'
* ]);
* ```
*
* ```
* // Using Bucket-Bound hostnames
* // By default, a custom bucket-bound hostname will use `http` as the schema rather than `https`.
* // In order to get an https URI, we need to specify the proper scheme.
* $url = $object->signedUrl(new \DateTime('tomorrow'), [
* 'version' => 'v4',
* 'bucketBoundHostname' => 'cdn.example.com',
* 'scheme' => 'https'
* ]);
* ```
*
* ```
* // Using virtual hosted style URIs
* // When true, returns a URL with the hostname `.storage.googleapis.com`.
* $url = $object->signedUrl(new \DateTime('tomorrow'), [
* 'virtualHostedStyle' => true
* ]);
* ````
*
* @see https://cloud.google.com/storage/docs/access-control/signed-urls Signed URLs
*
* @param Timestamp|\DateTimeInterface|int $expires Specifies when the URL
* will expire. May provide an instance of {@see \Google\Cloud\Core\Timestamp},
* [http://php.net/datetimeimmutable](`\DateTimeImmutable`), or a
* UNIX timestamp as an integer.
* @param array $options {
* Configuration Options.
*
* @type string $bucketBoundHostname The hostname for the bucket, for
* instance `cdn.example.com`. May be used for Google Cloud Load
* Balancers or for custom bucket CNAMEs. **Defaults to**
* `storage.googleapis.com`.
* @type string $contentMd5 The MD5 digest value in base64. If you
* provide this, the client must provide this HTTP header with
* this same value in its request. If provided, take care to
* always provide this value as a base64 encoded string.
* @type string $contentType If you provide this value, the client must
* provide this HTTP header set to the same value.
* @type bool $forceOpenssl If true, OpenSSL will be used regardless of
* whether phpseclib is available. **Defaults to** `false`.
* @type array $headers If additional headers are provided, the server
* will check to make sure that the client provides matching
* values. Provide headers as a key/value array, where the key is
* the header name, and the value is an array of header values.
* Headers with multiple values may provide values as a simple
* array, or a comma-separated string. For a reference of allowed
* headers, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers).
* Header values will be trimmed of leading and trailing spaces,
* multiple spaces within values will be collapsed to a single
* space, and line breaks will be replaced by an empty string.
* V2 Signed URLs may not provide `x-goog-encryption-key` or
* `x-goog-encryption-key-sha256` headers.
* @type FetchAuthTokenInterface $credentialsFetcher A credentials
* fetcher instance.
* @type array $keyFile [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* @type string $keyFilePath [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* @type string $method One of `GET`, `PUT` or `DELETE`.
* **Defaults to** `GET`.
* @type string $responseDisposition The
* [`response-content-disposition`](http://www.iana.org/assignments/cont-disp/cont-disp.xhtml)
* parameter of the signed url.
* @type string $responseType The `response-content-type` parameter of the
* signed url. When the server contentType is `null`, this option
* may be used to control the content type of the response.
* @type string $saveAsName The filename to prompt the user to save the
* file as when the signed url is accessed. This is ignored if
* `$options.responseDisposition` is set.
* @type string $scheme Either `http` or `https`. Only used if a custom
* hostname is provided via `$options.bucketBoundHostname`. If a
* custom bucketBoundHostname is provided, **defaults to** `http`.
* In all other cases, **defaults to** `https`.
* @type string|array $scopes One or more authentication scopes to be
* used with a key file. This option is ignored unless
* `$options.keyFile` or `$options.keyFilePath` is set.
* @type array $queryParams Additional query parameters to be included
* as part of the signed URL query string. For allowed values,
* see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query).
* @type string $version One of "v2" or "v4". **Defaults to** `"v2"`.
* @type bool $virtualHostedStyle If `true`, URL will be of form
* `mybucket.storage.googleapis.com`. If `false`,
* `storage.googleapis.com/mybucket`. **Defaults to** `false`.
* }
* @return string
* @throws \InvalidArgumentException If the given expiration is invalid or in the past.
* @throws \InvalidArgumentException If the given `$options.method` is not valid.
* @throws \InvalidArgumentException If the given `$options.keyFilePath` is not valid.
* @throws \InvalidArgumentException If the given custom headers are invalid.
* @throws \InvalidArgumentException If the keyfile does not contain the required information.
* @throws \RuntimeException If the credentials provided cannot be used for signing strings.
*/
public function signedUrl($expires, array $options = [])
{
// May be overridden for testing.
$signingHelper = $this->pluck('helper', $options, false)
?: SigningHelper::getHelper();
$resource = sprintf(
'/%s/%s',
$this->identity['bucket'],
$this->identity['object']
);
return $signingHelper->sign(
$this->connection,
$expires,
$resource,
$this->identity['generation'],
$options
);
}
/**
* Create a Signed Upload URL for this object.
*
* This method differs from {@see StorageObject::signedUrl()}
* in that it allows you to initiate a new resumable upload session. This
* can be used to allow non-authenticated users to insert an object into a
* bucket.
*
* In order to upload data, a session URI must be
* obtained by sending an HTTP POST request to the URL returned from this
* method. See the [Cloud Storage Documentation](https://goo.gl/b1ZiZm) for
* more information.
*
* If you prefer to skip this initial step, you may find
* {@see StorageObject::beginSignedUploadSession()} to
* fit your needs. Note that `beginSignedUploadSession()` cannot be used
* with Google Cloud PHP's Signed URL Uploader, and does not support a
* configurable expiration date.
*
* Example:
* ```
* $url = $object->signedUploadUrl(new \DateTime('tomorrow'));
* ```
*
* ```
* // Use Signed URLs v4
* $url = $object->signedUploadUrl(new \DateTime('tomorrow'), [
* 'version' => 'v4'
* ]);
* ```
*
* @param Timestamp|\DateTimeInterface|int $expires Specifies when the URL
* will expire. May provide an instance of {@see \Google\Cloud\Core\Timestamp},
* [http://php.net/datetimeimmutable](`\DateTimeImmutable`), or a
* UNIX timestamp as an integer.
* @param array $options {
* Configuration Options.
*
* @type string $contentMd5 The MD5 digest value in base64. If you
* provide this, the client must provide this HTTP header with
* this same value in its request. If provided, take care to
* always provide this value as a base64 encoded string.
* @type string $contentType If you provide this value, the client must
* provide this HTTP header set to the same value.
* @type bool $forceOpenssl If true, OpenSSL will be used regardless of
* whether phpseclib is available. **Defaults to** `false`.
* @type array $headers If additional headers are provided, the server
* will check to make sure that the client provides matching
* values. Provide headers as a key/value array, where the key is
* the header name, and the value is an array of header values.
* Headers with multiple values may provide values as a simple
* array, or a comma-separated string. For a reference of allowed
* headers, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers).
* Header values will be trimmed of leading and trailing spaces,
* multiple spaces within values will be collapsed to a single
* space, and line breaks will be replaced by an empty string.
* V2 Signed URLs may not provide `x-goog-encryption-key` or
* `x-goog-encryption-key-sha256` headers.
* @type FetchAuthTokenInterface $credentialsFetcher A credentials
* fetcher instance.
* @type array $keyFile [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* @type string $keyFilePath [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* @type string $responseDisposition The
* [`response-content-disposition`](http://www.iana.org/assignments/cont-disp/cont-disp.xhtml)
* parameter of the signed url.
* @type string $responseType The `response-content-type` parameter of the
* signed url. When the server contentType is `null`, this option
* may be used to control the content type of the response.
* @type string $saveAsName The filename to prompt the user to save the
* file as when the signed url is accessed. This is ignored if
* `$options.responseDisposition` is set.
* @type string $scheme Either `http` or `https`. Only used if a custom
* hostname is provided via `$options.bucketBoundHostname`. In all
* other cases, `https` is used. When a custom bucketBoundHostname
* is provided, **defaults to** `http`.
* @type string|array $scopes One or more authentication scopes to be
* used with a key file. This option is ignored unless
* `$options.keyFile` or `$options.keyFilePath` is set.
* @type array $queryParams Additional query parameters to be included
* as part of the signed URL query string. For allowed values,
* see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query).
* @type string $version One of "v2" or "v4". **Defaults to** `"v2"`.
* }
* @return string
*/
public function signedUploadUrl($expires, array $options = [])
{
$options += [
'headers' => []
];
$options['headers']['x-goog-resumable'] = 'start';
unset(
$options['cname'],
$options['bucketBoundHostname'],
$options['saveAsName'],
$options['responseDisposition'],
$options['responseType'],
$options['virtualHostedStyle']
);
return $this->signedUrl($expires, [
'method' => 'POST',
'allowPost' => true
] + $options);
}
/**
* Create a signed URL upload session.
*
* The returned URL differs from the return value of
* {@see StorageObject::signedUploadUrl()} in that it
* is ready to accept upload data immediately via an HTTP PUT request.
*
* Because an upload session is created by the client, the expiration date
* is not configurable. The URL generated by this method is valid for one
* week.
*
* Example:
* ```
* $url = $object->beginSignedUploadSession();
* ```
*
* ```
* // Use Signed URLs v4
* $url = $object->beginSignedUploadSession([
* 'version' => 'v4'
* ]);
* ```
*
* @see https://cloud.google.com/storage/docs/xml-api/resumable-upload#practices Resumable Upload Best Practices
*
* @param array $options {
* Configuration Options.
*
* @type string $contentMd5 The MD5 digest value in base64. If you
* provide this, the client must provide this HTTP header with
* this same value in its request. If provided, take care to
* always provide this value as a base64 encoded string.
* @type string $contentType If you provide this value, the client must
* provide this HTTP header set to the same value.
* @type bool $forceOpenssl If true, OpenSSL will be used regardless of
* whether phpseclib is available. **Defaults to** `false`.
* @type array $headers If additional headers are provided, the server
* will check to make sure that the client provides matching
* values. Provide headers as a key/value array, where the key is
* the header name, and the value is an array of header values.
* Headers with multiple values may provide values as a simple
* array, or a comma-separated string. For a reference of allowed
* headers, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers).
* Header values will be trimmed of leading and trailing spaces,
* multiple spaces within values will be collapsed to a single
* space, and line breaks will be replaced by an empty string.
* V2 Signed URLs may not provide `x-goog-encryption-key` or
* `x-goog-encryption-key-sha256` headers.
* @type FetchAuthTokenInterface $credentialsFetcher A credentials
* fetcher instance.
* @type array $keyFile [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* @type string $keyFilePath [DEPRECATED]
* This option is being deprecated because of a potential security risk.
* This option does not validate the credential configuration. The security
* risk occurs when a credential configuration is accepted from a source
* that is not under your control and used without validation on your side.
* If you know that you will be loading credential configurations of a
* specific type, it is recommended to create the credentials directly and
* configure them using the `credentialsFetcher` option instead.
* ```
* use Google\Auth\Credentials\ServiceAccountCredentials;
* $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);
* ```
* This will ensure that an unexpected credential type with potential for
* malicious intent is not loaded unintentionally. You might still have to do
* validation for certain credential types.
* If you are loading your credential configuration from an untrusted source and have
* not mitigated the risks (e.g. by validating the configuration yourself), make
* these changes as soon as possible to prevent security risks to your environment.
* Regardless of the method used, it is always your responsibility to validate
* configurations received from external sources.
* @see https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
* "Access-Control-Allow-Origin". **Defaults to** `"*"`.
* @type string|array $scopes One or more authentication scopes to be
* used with a key file. This option is ignored unless
* `$options.keyFile` or `$options.keyFilePath` is set.
* @type array $queryParams Additional query parameters to be included
* as part of the signed URL query string. For allowed values,
* see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query).
* @type string $version One of "v2" or "v4". **Defaults to** `"v2"`.
* }
* @return string
*/
public function beginSignedUploadSession(array $options = [])
{
$expires = new \DateTimeImmutable('+1 minute');
$startUri = $this->signedUploadUrl($expires, $options);
$uploaderOptions = $this->pluckArray([
'contentType',
'origin'
], $options);
if (!isset($uploaderOptions['origin'])) {
$uploaderOptions['origin'] = '*';
}
$uploader = new SignedUrlUploader($this->connection->requestWrapper(), '', $startUri, $uploaderOptions);
return $uploader->getResumeUri();
}
/**
* Retrieves the object's details. If no object data is cached a network
* request will be made to retrieve it.
*
* Example:
* ```
* $info = $object->info();
* echo $info['size'];
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/get Objects get API documentation.
*
* @param array $options [optional] {
* Configuration options.
*
* @type string $encryptionKey An AES-256 customer-supplied encryption
* key. It will be neccesary to provide this when a key was used
* during the object's creation in order to retrieve the MD5 hash
* and CRC32C checksum. If provided one must also include an
* `encryptionKeySHA256`.
* @type string $encryptionKeySHA256 The SHA256 hash of the
* customer-supplied encryption key. It will be neccesary to
* provide this when a key was used during the object's creation
* in order to retrieve the MD5 hash and CRC32C checksum. If
* provided one must also include an `encryptionKey`.
* @type string $ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given
* value.
* @type string $ifGenerationNotMatch Makes the operation conditional on
* whether the object's current generation does not match the
* given value.
* @type string $ifMetagenerationMatch Makes the operation conditional
* on whether the object's current metageneration matches the
* given value.
* @type string $ifMetagenerationNotMatch Makes the operation
* conditional on whether the object's current metageneration does
* not match the given value.
* @type string $projection Determines which properties to return. May
* be either 'full' or 'noAcl'.
* }
* @return array
*/
public function info(array $options = [])
{
return $this->info ?: $this->reload($options);
}
/**
* Triggers a network request to reload the object's details.
*
* Example:
* ```
* $object->reload();
* $info = $object->info();
* echo $info['location'];
* ```
*
* @see https://cloud.google.com/storage/docs/json_api/v1/objects/get Objects get API documentation.
*
* @param array $options [optional] {
* Configuration options.
*
* @type string $encryptionKey A base64 encoded AES-256 customer-supplied
* encryption key. It will be neccesary to provide this when a key
* was used during the object's creation.
* @type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
* customer-supplied encryption key. This value will be calculated
* from the `encryptionKey` on your behalf if not provided, but
* for best performance it is recommended to pass in a cached
* version of the already calculated SHA.
* @type string $ifGenerationMatch Makes the operation conditional on
* whether the object's current generation matches the given
* value.
* @type string $ifGenerationNotMatch Makes the operation conditional on
* whether the object's current generation does not match the
* given value.
* @type string $ifMetagenerationMatch Makes the operation conditional
* on whether the object's current metageneration matches the
* given value.
* @type string $ifMetagenerationNotMatch Makes the operation
* conditional on whether the object's current metageneration does
* not match the given value.
* @type string $projection Determines which properties to return. May
* be either 'full' or 'noAcl'.
* }
* @return array
*/
public function reload(array $options = [])
{
return $this->info = $this->connection->getObject(
$this->formatEncryptionHeaders(
$options
+ $this->encryptionData
+ array_filter($this->identity)
)
);
}
/**
* Retrieves the object's name.
*
* Example:
* ```
* echo $object->name();
* ```
*
* @return string
*/
public function name()
{
return $this->identity['object'];
}
/**
* Retrieves the object's identity.
*
* Example:
* ```
* echo $object->identity()['object'];
* ```
*
* @return array
*/
public function identity()
{
return $this->identity;
}
/**
* Formats the object as a string in the following format:
* `gs://{bucket-name}/{object-name}`.
*
* Example:
* ```
* echo $object->gcsUri();
* ```
*
* @return string
*/
public function gcsUri()
{
return sprintf(
'gs://%s/%s',
$this->identity['bucket'],
$this->identity['object']
);
}
/**
* Formats a destination based request, such as copy or rewrite.
*
* @param string|Bucket $destination The destination bucket.
* @param array $options Options to configure.
* @return array
*/
private function formatDestinationRequest($destination, array $options)
{
if (!is_string($destination) && !($destination instanceof Bucket)) {
throw new \InvalidArgumentException(
'$destination must be either a string or an instance of Bucket.'
);
}
$destAcl = $options['predefinedAcl'] ?? null;
$destObject = $options['name'] ?? $this->identity['object'];
unset($options['name']);
unset($options['predefinedAcl']);
return array_filter([
'destinationBucket' => $destination instanceof Bucket ? $destination->name() : $destination,
'destinationObject' => $destObject,
'destinationPredefinedAcl' => $destAcl,
'sourceBucket' => $this->identity['bucket'],
'sourceObject' => $this->identity['object'],
'sourceGeneration' => $this->identity['generation'],
'userProject' => $this->identity['userProject'],
]) + $this->formatEncryptionHeaders($options + $this->encryptionData);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/StreamWrapper.php
================================================
['option' => value]].
* Options used by StreamWrapper:
*
* flush (bool) `true`: fflush() will flush output buffer; `false`: fflush() will do nothing
*/
public $context;
/**
* @var \Psr\Http\Message\StreamInterface
*/
private $stream;
/**
* @var string Protocol used to open this stream
*/
private $protocol;
/**
* @var Bucket Reference to the bucket the opened file
* lives in or will live in.
*/
private $bucket;
/**
* @var string Name of the file opened by this stream.
*/
private $file;
/**
* @var StorageClient[] $clients The default clients to use if using
* global methods such as fopen on a stream wrapper. Keyed by protocol.
*/
private static $clients = [];
/**
* @var ObjectIterator Used for iterating through a directory
*/
private $directoryIterator;
/**
* @var StorageObject
*/
private $object;
/**
* @var array Context options passed to stream_open(), used for append mode and flushing.
*/
private $options = [];
/**
* @var bool `true`: fflush() will flush output buffer and redirect output to the "tail" object.
*/
private $flushing = false;
/**
* @var string|null Content type for composed object. Will be filled on first composing.
*/
private $contentType = null;
/**
* @var bool `true`: writing the "tail" object, next fflush() or fclose() will compose.
*/
private $composing = false;
/**
* @var bool `true`: data has been written to the stream.
*/
private $dirty = false;
/**
* Ensure we close the stream when this StreamWrapper is destroyed.
*/
public function __destruct()
{
$this->stream_close();
}
/**
* This is called when include/require is used on a stream.
*/
public function stream_set_option()
{
return false;
}
/**
* This is called when touch is used on a stream. See:
* https://www.php.net/manual/en/streamwrapper.stream-metadata.php
*/
public function stream_metadata($path, $option, $value)
{
if ($option == STREAM_META_TOUCH) {
$this->openPath($path);
return $this->touch();
}
return false;
}
/**
* Creates an empty file if it does not exist.
* @return bool Returns true if file exists or has been created, false otherwise.
*/
private function touch()
{
$object = $this->bucket->object($this->file);
try {
if (!$object->exists()) {
$this->bucket->upload('', [
'name' => $this->file
]);
}
return true;
} catch (NotFoundException $e) {
}
return false;
}
/**
* Register a StreamWrapper for reading and writing to Google Storage
*
* @param StorageClient $client The StorageClient configuration to use.
* @param string $protocol The name of the protocol to use. **Defaults to**
* `gs`.
* @throws \RuntimeException
*/
public static function register(StorageClient $client, $protocol = null)
{
$protocol = $protocol ?: self::DEFAULT_PROTOCOL;
if (!in_array($protocol, stream_get_wrappers())) {
if (!stream_wrapper_register($protocol, StreamWrapper::class, STREAM_IS_URL)) {
throw new \RuntimeException("Failed to register '$protocol://' protocol");
}
self::$clients[$protocol] = $client;
return true;
}
return false;
}
/**
* Unregisters the SteamWrapper
*
* @param string $protocol The name of the protocol to unregister. **Defaults
* to** `gs`.
*/
public static function unregister($protocol = null)
{
$protocol = $protocol ?: self::DEFAULT_PROTOCOL;
stream_wrapper_unregister($protocol);
unset(self::$clients[$protocol]);
}
/**
* Get the default client to use for streams.
*
* @param string $protocol The name of the protocol to get the client for.
* **Defaults to** `gs`.
* @return StorageClient
*/
public static function getClient($protocol = null)
{
$protocol = $protocol ?: self::DEFAULT_PROTOCOL;
return self::$clients[$protocol];
}
/**
* Callback handler for when a stream is opened. For reads, we need to
* download the file to see if it can be opened.
*
* @param string $path The path of the resource to open
* @param string $mode The fopen mode. Currently supports ('r', 'rb', 'rt', 'w', 'wb', 'wt', 'a', 'ab', 'at')
* @param int $flags Bitwise options STREAM_USE_PATH|STREAM_REPORT_ERRORS|STREAM_MUST_SEEK
* @param string $openedPath Will be set to the path on success if STREAM_USE_PATH option is set
* @return bool
*/
public function stream_open($path, $mode, $flags, &$openedPath)
{
$this->openPath($path);
// strip off 'b' or 't' from the mode
$mode = rtrim($mode, 'bt');
$options = [];
if ($this->context) {
$contextOptions = stream_context_get_options($this->context);
if (array_key_exists($this->protocol, $contextOptions)) {
$options = $contextOptions[$this->protocol] ?: [];
}
if (isset($options['flush'])) {
$this->flushing = (bool) $options['flush'];
unset($options['flush']);
}
$this->options = $options;
}
if ($mode == 'w') {
$this->stream = new WriteStream(null, $options);
$this->stream->setUploader(
$this->bucket->getStreamableUploader(
$this->stream,
$options + ['name' => $this->file]
)
);
} elseif ($mode == 'a') {
try {
$info = $this->bucket->object($this->file)->info();
$this->composing = ($info['size'] > 0);
} catch (NotFoundException $e) {
}
$this->stream = new WriteStream(null, $options);
$name = $this->file;
if ($this->composing) {
$name .= self::TAIL_NAME_SUFFIX;
}
$this->stream->setUploader(
$this->bucket->getStreamableUploader(
$this->stream,
$options + ['name' => $name]
)
);
} elseif ($mode == 'r') {
try {
// Lazy read from the source
$options['restOptions']['stream'] = true;
$this->stream = new ReadStream(
$this->bucket->object($this->file)->downloadAsStream($options)
);
// Wrap the response in a caching stream to make it seekable
if (!$this->stream->isSeekable() && ($flags & STREAM_MUST_SEEK)) {
$this->stream = new CachingStream($this->stream);
}
} catch (ServiceException $ex) {
return $this->returnError($ex->getMessage(), $flags);
}
} else {
return $this->returnError('Unknown stream_open mode.', $flags);
}
if ($flags & STREAM_USE_PATH) {
$openedPath = $path;
}
return true;
}
/**
* Callback handler for when we try to read a certain number of bytes.
*
* @param int $count The number of bytes to read.
*
* @return string
*/
public function stream_read($count)
{
return $this->stream->read($count);
}
/**
* Callback handler for when we try to write data to the stream.
*
* @param string $data The data to write
*
* @return int The number of bytes written.
*/
public function stream_write($data)
{
$result = $this->stream->write($data);
$this->dirty = $this->dirty || (bool) $result;
return $result;
}
/**
* Callback handler for getting data about the stream.
*
* @return array
*/
public function stream_stat()
{
$mode = $this->stream->isWritable()
? self::FILE_WRITABLE_MODE
: self::FILE_READABLE_MODE;
return $this->makeStatArray([
'mode' => $mode,
'size' => $this->stream->getSize()
]);
}
/**
* Callback handler for checking to see if the stream is at the end of file.
*
* @return bool
*/
public function stream_eof()
{
return $this->stream->eof();
}
/**
* Callback handler for trying to close the stream.
*/
public function stream_close()
{
if (isset($this->stream)) {
$this->stream->close();
}
if ($this->composing) {
if ($this->dirty) {
$this->compose();
$this->dirty = false;
}
try {
$this->bucket->object($this->file . self::TAIL_NAME_SUFFIX)->delete();
} catch (NotFoundException $e) {
}
$this->composing = false;
}
}
/**
* Callback handler for trying to seek to a certain location in the stream.
*
* @param int $offset The stream offset to seek to
* @param int $whence Flag for what the offset is relative to. See:
* http://php.net/manual/en/streamwrapper.stream-seek.php
* @return bool
*/
public function stream_seek($offset, $whence = SEEK_SET)
{
if ($this->stream->isSeekable()) {
$this->stream->seek($offset, $whence);
return true;
}
return false;
}
/**
* Callhack handler for inspecting our current position in the stream
*
* @return int
*/
public function stream_tell()
{
return $this->stream->tell();
}
/**
* Callback handler for trying to close an opened directory.
*
* @return bool
*/
public function dir_closedir()
{
return false;
}
/**
* Callback handler for trying to open a directory.
*
* @param string $path The url directory to open
* @param int $options Whether or not to enforce safe_mode
* @return bool
*/
public function dir_opendir($path, $options)
{
$this->openPath($path);
return $this->dir_rewinddir();
}
/**
* Callback handler for reading an entry from a directory handle.
*
* @return string|bool
*/
public function dir_readdir()
{
$name = $this->directoryIterator->current();
if ($name) {
$this->directoryIterator->next();
return $name;
}
return false;
}
/**
* Callback handler for rewind the directory handle.
*
* @return bool
*/
public function dir_rewinddir()
{
try {
$iterator = $this->bucket->objects([
'prefix' => $this->file,
'fields' => 'items/name,nextPageToken'
]);
// The delimiter options do not give us what we need, so instead we
// list all results matching the given prefix, enumerate the
// iterator, filter and transform results, and yield a fresh
// generator containing only the directory listing.
$this->directoryIterator = call_user_func(function () use ($iterator) {
$yielded = [];
$pathLen = strlen($this->makeDirectory($this->file));
foreach ($iterator as $object) {
$name = substr($object->name(), $pathLen);
$parts = explode('/', $name);
// since the service call returns nested results and we only
// want to yield results directly within the requested directory,
// check if we've already yielded this value.
if ($parts[0] === '' || in_array($parts[0], $yielded)) {
continue;
}
$yielded[] = $parts[0];
yield $name => $parts[0];
}
});
} catch (ServiceException $e) {
return false;
}
return true;
}
/**
* Callback handler for trying to create a directory. If no file path is specified,
* or STREAM_MKDIR_RECURSIVE option is set, then create the bucket if it does not exist.
*
* @param string $path The url directory to create
* @param int $mode The permissions on the directory
* @param int $options Bitwise mask of options. STREAM_MKDIR_RECURSIVE
* @return bool
*/
public function mkdir($path, $mode, $options)
{
$path = $this->makeDirectory($path);
$client = $this->openPath($path);
$predefinedAcl = $this->determineAclFromMode($mode);
try {
if ($options & STREAM_MKDIR_RECURSIVE || $this->file == '') {
if (!$this->bucket->exists()) {
$client->createBucket($this->bucket->name(), [
'predefinedAcl' => $predefinedAcl,
'predefinedDefaultObjectAcl' => $predefinedAcl
]);
}
}
// If the file name is empty, we were trying to create a bucket. In this case,
// don't create the placeholder file.
if ($this->file != '') {
$bucketInfo = $this->bucket->info();
$ublEnabled = isset($bucketInfo['iamConfiguration']['uniformBucketLevelAccess']) &&
$bucketInfo['iamConfiguration']['uniformBucketLevelAccess']['enabled'] === true;
// if bucket has uniform bucket level access enabled, don't set ACLs.
$acl = [];
if (!$ublEnabled) {
$acl = [
'predefinedAcl' => $predefinedAcl
];
}
// Fake a directory by creating an empty placeholder file whose name ends in '/'
$this->bucket->upload('', [
'name' => $this->file,
] + $acl);
}
} catch (ServiceException $e) {
return false;
}
return true;
}
/**
* Callback handler for trying to move a file or directory.
*
* @param string $from The URL to the current file
* @param string $to The URL of the new file location
* @return bool
*/
public function rename($from, $to)
{
$this->openPath($from);
$destination = (array) parse_url($to) + [
'path' => '',
'host' => ''
];
$destinationBucket = $destination['host'];
$destinationPath = substr($destination['path'], 1);
// loop through to rename file and children, if given path is a directory.
$objects = $this->bucket->objects([
'prefix' => $this->file
]);
foreach ($objects as $obj) {
$oldName = $obj->name();
$newPath = str_replace($this->file, $destinationPath, $oldName);
try {
$obj->rename($newPath, [
'destinationBucket' => $destinationBucket
]);
} catch (ServiceException $e) {
return false;
}
}
return true;
}
/**
* Callback handler for trying to remove a directory or a bucket. If the path is empty
* or '/', the bucket will be deleted.
*
* Note that the STREAM_MKDIR_RECURSIVE flag is ignored because the option cannot
* be set via the `rmdir()` function.
*
* @param string $path The URL directory to remove. If the path is empty or is '/',
* This will attempt to destroy the bucket.
* @param int $options Bitwise mask of options.
* @return bool
*/
public function rmdir($path, $options)
{
$path = $this->makeDirectory($path);
$this->openPath($path);
try {
if ($this->file == '') {
$this->bucket->delete();
return true;
} else {
return $this->unlink($path);
}
} catch (ServiceException $e) {
return false;
}
}
/**
* Callback handler for retrieving the underlaying resource
*
* @param int $castAs STREAM_CAST_FOR_SELECT|STREAM_CAST_AS_STREAM
* @return resource|bool
*/
public function stream_cast($castAs)
{
return false;
}
/**
* Callback handler for deleting a file
*
* @param string $path The URL of the file to delete
* @return bool
*/
public function unlink($path)
{
$client = $this->openPath($path);
$object = $this->bucket->object($this->file);
try {
$object->delete();
return true;
} catch (ServiceException $e) {
return false;
}
}
/**
* Callback handler for retrieving information about a file
*
* @param string $path The URI to the file
* @param int $flags Bitwise mask of options
* @return array|bool
*/
public function url_stat($path, $flags)
{
$client = $this->openPath($path);
// if directory
$dir = $this->getDirectoryInfo($this->file);
if ($dir) {
return $this->urlStatDirectory($dir);
}
return $this->urlStatFile();
}
/**
* Callback handler for fflush() function.
*
* @return bool
*/
public function stream_flush()
{
if (!$this->flushing) {
return false;
}
if (!$this->dirty) {
return true;
}
if (isset($this->stream)) {
$this->stream->close();
}
if ($this->composing) {
$this->compose();
}
$options = $this->options;
$this->stream = new WriteStream(null, $options);
$this->stream->setUploader(
$this->bucket->getStreamableUploader(
$this->stream,
$options + ['name' => $this->file . self::TAIL_NAME_SUFFIX]
)
);
$this->composing = true;
$this->dirty = false;
return true;
}
/**
* Parse the URL and set protocol, filename and bucket.
*
* @param string $path URL to open
* @return StorageClient
*/
private function openPath($path)
{
$url = (array) parse_url($path) + [
'scheme' => '',
'path' => '',
'host' => ''
];
$this->protocol = $url['scheme'];
$this->file = ltrim($url['path'], '/');
$client = self::getClient($this->protocol);
$this->bucket = $client->bucket($url['host']);
return $client;
}
/**
* Given a path, ensure that we return a path that looks like a directory
*
* @param string $path
* @return string
*/
private function makeDirectory($path)
{
if ($path == '' or $path == '/') {
return '';
}
if (substr($path, -1) == '/') {
return $path;
}
return $path . '/';
}
/**
* Calculate the `url_stat` response for a directory
*
* @return array|bool
*/
private function urlStatDirectory(StorageObject $object)
{
$stats = [];
$info = $object->info();
// equivalent to 40777 and 40444 in octal
$stats['mode'] = $this->bucket->isWritable()
? self::DIRECTORY_WRITABLE_MODE
: self::DIRECTORY_READABLE_MODE;
$this->statsFromFileInfo($info, $stats);
return $this->makeStatArray($stats);
}
/**
* Calculate the `url_stat` response for a file
*
* @return array|bool
*/
private function urlStatFile()
{
try {
$this->object = $this->bucket->object($this->file);
$info = $this->object->info();
} catch (ServiceException $e) {
// couldn't stat file
return false;
}
// equivalent to 100666 and 100444 in octal
$stats = [
'mode' => $this->bucket->isWritable()
? self::FILE_WRITABLE_MODE
: self::FILE_READABLE_MODE
];
$this->statsFromFileInfo($info, $stats);
return $this->makeStatArray($stats);
}
/**
* Given a `StorageObject` info array, extract the available fields into the
* provided `$stats` array.
*
* @param array $info Array provided from a `StorageObject`.
* @param array $stats Array to put the calculated stats into.
*/
private function statsFromFileInfo(array &$info, array &$stats)
{
$stats['size'] = (isset($info['size']))
? (int) $info['size']
: null;
$stats['mtime'] = (isset($info['updated']))
? strtotime($info['updated'])
: null;
$stats['ctime'] = (isset($info['timeCreated']))
? strtotime($info['timeCreated'])
: null;
}
/**
* Get the given path as a directory.
*
* In list objects calls, directories are returned with a trailing slash. By
* providing the given path with a trailing slash as a list prefix, we can
* check whether the given path exists as a directory.
*
* If the path does not exist or is not a directory, return null.
*
* @param string $path
* @return StorageObject|null
*/
private function getDirectoryInfo($path)
{
$scan = $this->bucket->objects([
'prefix' => $this->makeDirectory($path),
'resultLimit' => 1,
'fields' => 'items/name,items/size,items/updated,items/timeCreated,nextPageToken'
]);
return $scan->current();
}
/**
* Returns the associative array that a `stat()` response expects using the
* provided stats. Defaults the remaining fields to 0.
*
* @param array $stats Sparse stats entries to set.
* @return array
*/
private function makeStatArray($stats)
{
return array_merge(
array_fill_keys([
'dev',
'ino',
'mode',
'nlink',
'uid',
'gid',
'rdev',
'size',
'atime',
'mtime',
'ctime',
'blksize',
'blocks'
], 0),
$stats
);
}
/**
* Helper for whether or not to trigger an error or just return false on an error.
*
* @param string $message The PHP error message to emit.
* @param int $flags Bitwise mask of options (STREAM_REPORT_ERRORS)
* @return bool Returns false
*/
private function returnError($message, $flags)
{
if ($flags & STREAM_REPORT_ERRORS) {
trigger_error($message, E_USER_WARNING);
}
return false;
}
/**
* Helper for determining which predefinedAcl to use given a mode.
*
* @param int $mode Decimal representation of the file system permissions
* @return string
*/
private function determineAclFromMode($mode)
{
if ($mode & 0004) {
// If any user can read, assume it should be publicRead.
return 'publicRead';
} elseif ($mode & 0040) {
// If any group user can read, assume it should be projectPrivate.
return 'projectPrivate';
}
// Otherwise, assume only the project/bucket owner can use the bucket.
return 'private';
}
private function compose()
{
if (!isset($this->contentType)) {
$info = $this->bucket->object($this->file)->info();
$this->contentType = $info['contentType'] ?: 'application/octet-stream';
}
$options = ['destination' => ['contentType' => $this->contentType]];
$this->bucket->compose([$this->file, $this->file . self::TAIL_NAME_SUFFIX], $this->file, $options);
}
}
================================================
FILE: lib/Google/vendor/google/cloud-storage/src/WriteStream.php
================================================
setUploader($uploader);
}
if (array_key_exists('chunkSize', $options)) {
$this->chunkSize = $options['chunkSize'];
}
$this->stream = new BufferStream($this->chunkSize);
}
/**
* Close the stream. Uploads any remaining data.
*/
public function close(): void
{
if ($this->uploader && $this->hasWritten) {
$this->uploader->upload();
$this->uploader = null;
}
}
/**
* Write to the stream. If we pass the chunkable size, upload the available chunk.
*
* @param string $data Data to write
* @return int The number of bytes written
* @throws \RuntimeException
*/
public function write($data): int
{
if (!isset($this->uploader)) {
throw new \RuntimeException('No uploader set.');
}
// Ensure we have a resume uri here because we need to create the streaming
// upload before we have data (size of 0).
$this->uploader->getResumeUri();
$this->hasWritten = true;
if (!$this->stream->write($data)) {
$this->uploader->upload($this->getChunkedWriteSize());
}
return strlen($data);
}
/**
* Set the uploader for this class. You may need to set this after initialization
* if the uploader depends on this stream.
*
* @param AbstractUploader $uploader The new uploader to use.
*/
public function setUploader($uploader): void
{
$this->uploader = $uploader;
}
private function getChunkedWriteSize(): int
{
return (int) floor($this->getSize() / $this->chunkSize) * $this->chunkSize;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/CHANGELOG.md
================================================
# Changelog
## [4.5.0](https://github.com/googleapis/common-protos-php/compare/v4.4.0...v4.5.0) (2023-11-29)
### Features
* Add auto_populated_fields to google.api.MethodSettings ([#74](https://github.com/googleapis/common-protos-php/issues/74)) ([d739417](https://github.com/googleapis/common-protos-php/commit/d7394176eb95f0e92af4e93746dba8f515ba9bc2))
## [4.4.0](https://github.com/googleapis/common-protos-php/compare/v4.3.0...v4.4.0) (2023-10-02)
### Features
* Public google.api.FieldInfo type and extension ([#71](https://github.com/googleapis/common-protos-php/issues/71)) ([4002074](https://github.com/googleapis/common-protos-php/commit/40020744c65e7561dec08e1cd2994afcc51ec771))
## [4.3.0](https://github.com/googleapis/common-protos-php/compare/v4.2.0...v4.3.0) (2023-08-22)
### Features
* Add new FieldBehavior value IDENTIFIER ([#67](https://github.com/googleapis/common-protos-php/issues/67)) ([6c6c21f](https://github.com/googleapis/common-protos-php/commit/6c6c21fc4a2f4711aeddad11082ed17acaf4733c))
## [4.2.0](https://github.com/googleapis/common-protos-php/compare/v4.1.0...v4.2.0) (2023-07-25)
### Features
* Add a proto message to describe the `resource_type` and `resource_permission` for an API method ([#64](https://github.com/googleapis/common-protos-php/issues/64)) ([8a0ff5f](https://github.com/googleapis/common-protos-php/commit/8a0ff5f9ffcf3683fc4718e85e97f45a001a1925))
## [4.1.0](https://github.com/googleapis/common-protos-php/compare/v4.0.0...v4.1.0) (2023-05-06)
### Features
* Add ConfigServiceV2.CreateBucketAsync method for creating Log Buckets asynchronously ([b18d554](https://github.com/googleapis/common-protos-php/commit/b18d55421cbe1e55d62b5d149e56be23db8c4286))
* Add ConfigServiceV2.CreateLink method for creating linked datasets for Log Analytics Buckets ([b18d554](https://github.com/googleapis/common-protos-php/commit/b18d55421cbe1e55d62b5d149e56be23db8c4286))
* Add ConfigServiceV2.DeleteLink method for deleting linked datasets ([b18d554](https://github.com/googleapis/common-protos-php/commit/b18d55421cbe1e55d62b5d149e56be23db8c4286))
* Add ConfigServiceV2.GetLink methods for describing linked datasets ([b18d554](https://github.com/googleapis/common-protos-php/commit/b18d55421cbe1e55d62b5d149e56be23db8c4286))
* Add ConfigServiceV2.ListLinks method for listing linked datasets ([b18d554](https://github.com/googleapis/common-protos-php/commit/b18d55421cbe1e55d62b5d149e56be23db8c4286))
* Add ConfigServiceV2.UpdateBucketAsync method for creating Log Buckets asynchronously ([b18d554](https://github.com/googleapis/common-protos-php/commit/b18d55421cbe1e55d62b5d149e56be23db8c4286))
* Add LogBucket.analytics_enabled field that specifies whether Log Bucket's Analytics features are enabled ([b18d554](https://github.com/googleapis/common-protos-php/commit/b18d55421cbe1e55d62b5d149e56be23db8c4286))
* Add LogBucket.index_configs field that contains a list of Log Bucket's indexed fields and related configuration data ([b18d554](https://github.com/googleapis/common-protos-php/commit/b18d55421cbe1e55d62b5d149e56be23db8c4286))
* Log Analytics features of the Cloud Logging API ([#60](https://github.com/googleapis/common-protos-php/issues/60)) ([b18d554](https://github.com/googleapis/common-protos-php/commit/b18d55421cbe1e55d62b5d149e56be23db8c4286))
## [4.0.0](https://github.com/googleapis/common-protos-php/compare/v3.2.0...v4.0.0) (2023-05-01)
### ⚠ BREAKING CHANGES
* remove files unknown to owlbot ([#59](https://github.com/googleapis/common-protos-php/issues/59))
* add owlbot automated updates ([#54](https://github.com/googleapis/common-protos-php/issues/54))
### Features
* Add owlbot automated updates ([#54](https://github.com/googleapis/common-protos-php/issues/54)) ([6d9134d](https://github.com/googleapis/common-protos-php/commit/6d9134d2f927e9c4aa3165e823477e25ef8ff38f))
* Regenerate all common protos from new owlbot config ([#58](https://github.com/googleapis/common-protos-php/issues/58)) ([5dac653](https://github.com/googleapis/common-protos-php/commit/5dac653bdd60c4dbaec45e73e0ec487e5aeac9b1))
### Miscellaneous Chores
* Remove files unknown to owlbot ([#59](https://github.com/googleapis/common-protos-php/issues/59)) ([f541342](https://github.com/googleapis/common-protos-php/commit/f54134263a142e278c56f5e03e5a3d8c6f72aac3))
## [3.2.0](https://github.com/googleapis/common-protos-php/compare/v3.1.0...v3.2.0) (2023-01-12)
### Features
* Refresh types ([#49](https://github.com/googleapis/common-protos-php/issues/49)) ([bd71fc0](https://github.com/googleapis/common-protos-php/commit/bd71fc05cbca1ccd94b71a42c227f0d69c688f07))
## [3.1.0](https://github.com/googleapis/common-protos-php/compare/v3.0.0...v3.1.0) (2022-10-05)
### Features
* Make autoloader more efficient ([#45](https://github.com/googleapis/common-protos-php/issues/45)) ([cdff58a](https://github.com/googleapis/common-protos-php/commit/cdff58a3ff6c42e461f18f14c0bbd8e171456924))
## [3.0.0](https://github.com/googleapis/common-protos-php/compare/2.1.0...v3.0.0) (2022-07-29)
### ⚠ BREAKING CHANGES
* remove longrunning classes from common protos (#41)
### Miscellaneous Chores
* remove longrunning classes from common protos ([#41](https://github.com/googleapis/common-protos-php/issues/41)) ([e88dd1d](https://github.com/googleapis/common-protos-php/commit/e88dd1d5dfef93358dc0bd7f3d62d09bbfd750b6))
================================================
FILE: lib/Google/vendor/google/common-protos/CODE_OF_CONDUCT.md
================================================
# Contributor Code of Conduct
As contributors and maintainers of this project,
and in the interest of fostering an open and welcoming community,
we pledge to respect all people who contribute through reporting issues,
posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.
We are committed to making participation in this project
a harassment-free experience for everyone,
regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information,
such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct.
By adopting this Code of Conduct,
project maintainers commit themselves to fairly and consistently
applying these principles to every aspect of managing this project.
Project maintainers who do not follow or enforce the Code of Conduct
may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior
may be reported by opening an issue
or contacting one or more of the project maintainers.
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
================================================
FILE: lib/Google/vendor/google/common-protos/CONTRIBUTING.md
================================================
## Contributing
We are pleased that you are interested in contributing to our work.
### Generated Protocol Buffer Classes
The classes in this repository are generated by the protocol buffer
compiler, as known as protoc. As such, we can not accept contributions
directly to these generated classes. Instead, changes should be
suggested upstream in the [API Common Protos][api-common-protos]
repository.
### Documentation
We want for both protocol buffers and the types that we have provided here
to be understandable to everyone, including to those who may be unfamiliar
with the ecosystem or concepts.
That means we want our documentation to be better, and welcome anyone
willing to help with this. For documentation in the generated classes, please
open a pull request against the [API Common Protos][api-common-protos]
repository.
Any improvements to READMEs or other non-generated documentation or
development scripts in this repository would be greatly appreciated - please
open a pull request.
## Contributor License Agreement
Before we can accept your pull requests, you will need to sign a Contributor
License Agreement (CLA):
- **If you are an individual writing original source code** and **you own the
intellectual property**, then you need to sign an [individual CLA][].
- **If you work for a company that wants to allow you to contribute your
work**, then you need to sign a [corporate CLA][].
You can sign these electronically (just scroll to the bottom). After that,
we'll be able to accept your pull requests.
[individual CLA]: https://developers.google.com/open-source/cla/individual
[corporate CLA]: https://developers.google.com/open-source/cla/corporate
[api-common-protos]: https://github.com/googleapis/api-common-protos
================================================
FILE: lib/Google/vendor/google/common-protos/LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: lib/Google/vendor/google/common-protos/README.md
================================================
## Common Protos PHP
[](https://packagist.org/packages/google/common-protos) [](https://packagist.org/packages/google/common-protos)
* [API documentation](https://cloud.google.com/php/docs/reference/common-protos/latest)
This repository is a home for the [protocol buffer][protobuf] types which are
common dependencies throughout the Google API ecosystem, generated for PHP.
The protobuf definitions for these generated PHP classes are provided by the
[Common Components AIP][common-components-aip] repository.
**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any
support requests, bug reports, or development contributions should be directed to
that project.
## Using these generated classes
These classes are made available under an Apache license (see `LICENSE`) and
you are free to depend on them within your applications. They are
considered stable and will not change in backwards-incompaible ways.
They are distributed as the [google/common-protos][packagist-common-protos]
composer package, available on [Packagist][packagist].
In order to depend on these classes, use composer from the command line in order
to add this package to your `composer.json` file in the `requires` section:
```bash
composer require google/common-protos
```
## License
These classes are licensed using the Apache 2.0 software license, a
permissive, copyfree license. You are free to use them in your applications
provided the license terms are honored.
[protobuf]: https://developers.google.com/protocol-buffers/
[common-components-aip]: https://google.aip.dev/213
[packagist-common-protos]: https://packagist.org/packages/google/common-protos/
[packagist]: https://packagist.org/
================================================
FILE: lib/Google/vendor/google/common-protos/SECURITY.md
================================================
# Security Policy
To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
================================================
FILE: lib/Google/vendor/google/common-protos/VERSION
================================================
4.12.4
================================================
FILE: lib/Google/vendor/google/common-protos/composer.json
================================================
{
"name": "google/common-protos",
"type": "library",
"description": "Google API Common Protos for PHP",
"version": "4.12.4",
"keywords": [
"google"
],
"homepage": "https://github.com/googleapis/common-protos-php",
"license": "Apache-2.0",
"require": {
"php": "^8.1",
"google/protobuf": "^4.31"
},
"require-dev": {
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": {
"Google\\Api\\": "src/Api",
"Google\\Cloud\\": "src/Cloud",
"Google\\Iam\\": "src/Iam",
"Google\\Rpc\\": "src/Rpc",
"Google\\Type\\": "src/Type",
"GPBMetadata\\Google\\Api\\": "metadata/Api",
"GPBMetadata\\Google\\Cloud\\": "metadata/Cloud",
"GPBMetadata\\Google\\Iam\\": "metadata/Iam",
"GPBMetadata\\Google\\Logging\\": "metadata/Logging",
"GPBMetadata\\Google\\Rpc\\": "metadata/Rpc",
"GPBMetadata\\Google\\Type\\": "metadata/Type"
}
},
"extra": {
"component": {
"id": "common-protos",
"target": "googleapis/common-protos-php.git",
"path": "CommonProtos",
"entry": "README.md"
}
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Annotations.php
================================================
internalAddGeneratedFile(
'
google/api/annotations.proto
google.api google/protobuf/descriptor.protoBn
com.google.apiBAnnotationsProtoPZAgoogle.golang.org/genproto/googleapis/api/annotations;annotationsGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Billing.php
================================================
internalAddGeneratedFile(
'
google/api/billing.proto
google.api"
BillingE
consumer_destinations (2&.google.api.Billing.BillingDestinationA
BillingDestination
monitored_resource (
metrics ( Bn
com.google.apiBBillingProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Context.php
================================================
internalAddGeneratedFile(
'
google/api/context.proto
google.api"1
Context&
rules (2.google.api.ContextRule"
ContextRule
selector (
requested (
provided ( "
allowed_request_extensions ( #
allowed_response_extensions ( Bn
com.google.apiBContextProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Control.php
================================================
internalAddGeneratedFile(
'
google/api/control.proto
google.api"Q
Control
environment ( 1
method_policies (2.google.api.MethodPolicyBn
com.google.apiBControlProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Documentation.php
================================================
internalAddGeneratedFile(
'
google/api/documentation.proto
google.api"
Documentation
summary (
pages (2.google.api.Page,
rules (2.google.api.DocumentationRule
documentation_root_url (
service_root_url (
overview ( "[
DocumentationRule
selector (
description (
deprecation_description ( "I
Page
name (
content ( "
subpages (2.google.api.PageBt
com.google.apiBDocumentationProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Endpoint.php
================================================
internalAddGeneratedFile(
'
google/api/endpoint.proto
google.api"M
Endpoint
name (
aliases (
targete (
allow_cors (Bo
com.google.apiB
EndpointProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Httpbody.php
================================================
internalAddGeneratedFile(
'
google/api/httpbody.proto
google.api"X
HttpBody
content_type (
data ((
extensions (2.google.protobuf.AnyBe
com.google.apiB
HttpBodyProtoPZ;google.golang.org/genproto/googleapis/api/httpbody;httpbodyGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Log.php
================================================
internalAddGeneratedFile(
'
google/api/log.proto
google.api"u
LogDescriptor
name ( +
labels (2.google.api.LabelDescriptor
description (
display_name ( Bj
com.google.apiBLogProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Logging.php
================================================
internalAddGeneratedFile(
'
google/api/logging.proto
google.api"
LoggingE
producer_destinations (2&.google.api.Logging.LoggingDestinationE
consumer_destinations (2&.google.api.Logging.LoggingDestination>
LoggingDestination
monitored_resource (
logs ( Bn
com.google.apiBLoggingProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/MonitoredResource.php
================================================
internalAddGeneratedFile(
'
#google/api/monitored_resource.proto
google.apigoogle/api/launch_stage.protogoogle/protobuf/struct.proto"
MonitoredResourceDescriptor
name (
type (
display_name (
description ( +
labels (2.google.api.LabelDescriptor-
launch_stage (2.google.api.LaunchStage"
MonitoredResource
type ( 9
labels (2).google.api.MonitoredResource.LabelsEntry-
LabelsEntry
key (
value ( :8"
MonitoredResourceMetadata.
system_labels (2.google.protobuf.StructJ
user_labels (25.google.api.MonitoredResourceMetadata.UserLabelsEntry1
UserLabelsEntry
key (
value ( :8Bv
com.google.apiBMonitoredResourceProtoPZCgoogle.golang.org/genproto/googleapis/api/monitoredres;monitoredresGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Monitoring.php
================================================
internalAddGeneratedFile(
'
google/api/monitoring.proto
google.api"
MonitoringK
producer_destinations (2,.google.api.Monitoring.MonitoringDestinationK
consumer_destinations (2,.google.api.Monitoring.MonitoringDestinationD
MonitoringDestination
monitored_resource (
metrics ( Bq
com.google.apiBMonitoringProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Policy.php
================================================
internalAddGeneratedFile(
'
google/api/policy.proto
google.api google/protobuf/descriptor.proto"S
FieldPolicy
selector (
resource_permission (
resource_type ( "S
MethodPolicy
selector ( 1
request_policies (2.google.api.FieldPolicyBm
com.google.apiBPolicyProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Quota.php
================================================
internalAddGeneratedFile(
'
google/api/quota.proto
google.api"]
Quota&
limits (2.google.api.QuotaLimit,
metric_rules (2.google.api.MetricRule"
MetricRule
selector ( =
metric_costs (2\'.google.api.MetricRule.MetricCostsEntry2
MetricCostsEntry
key (
value (:8"
QuotaLimit
name (
description (
default_limit (
max_limit (
free_tier (
duration (
metric (
unit ( 2
values
(2".google.api.QuotaLimit.ValuesEntry
display_name ( -
ValuesEntry
key (
value (:8Bl
com.google.apiB
QuotaProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Routing.php
================================================
internalAddGeneratedFile(
'
google/api/routing.proto
google.api google/protobuf/descriptor.proto"G
RoutingRule8
routing_parameters (2.google.api.RoutingParameter"8
RoutingParameter
field (
path_template ( Bj
com.google.apiBRoutingProtoPZAgoogle.golang.org/genproto/googleapis/api/annotations;annotationsGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Service.php
================================================
internalAddGeneratedFile(
'
google/api/service.proto
google.apigoogle/api/backend.protogoogle/api/billing.protogoogle/api/client.protogoogle/api/context.protogoogle/api/control.protogoogle/api/documentation.protogoogle/api/endpoint.protogoogle/api/http.protogoogle/api/log.protogoogle/api/logging.protogoogle/api/metric.proto#google/api/monitored_resource.protogoogle/api/monitoring.protogoogle/api/quota.protogoogle/api/source_info.proto!google/api/system_parameter.protogoogle/api/usage.protogoogle/protobuf/api.protogoogle/protobuf/type.protogoogle/protobuf/wrappers.proto"
Service
name (
title (
producer_project_id (
id! ( "
apis (2.google.protobuf.Api$
types (2.google.protobuf.Type$
enums (2.google.protobuf.Enum0
documentation (2.google.api.Documentation$
backend (2.google.api.Backend
http (2.google.api.Http
quota
(2.google.api.Quota2
authentication (2.google.api.Authentication$
context (2.google.api.Context
usage (2.google.api.Usage\'
endpoints (2.google.api.Endpoint$
control (2.google.api.Control\'
logs (2.google.api.LogDescriptor-
metrics (2.google.api.MetricDescriptorD
monitored_resources (2\'.google.api.MonitoredResourceDescriptor$
billing (2.google.api.Billing$
logging (2.google.api.Logging*
monitoring (2.google.api.Monitoring7
system_parameters (2.google.api.SystemParameters+
source_info% (2.google.api.SourceInfo*
publishing- (2.google.api.Publishing4
config_version (2.google.protobuf.UInt32ValueBn
com.google.apiBServiceProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/SourceInfo.php
================================================
internalAddGeneratedFile(
'
google/api/source_info.proto
google.api"8
SourceInfo*
source_files (2.google.protobuf.AnyBq
com.google.apiBSourceInfoProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/SystemParameter.php
================================================
internalAddGeneratedFile(
'
!google/api/system_parameter.proto
google.api"B
SystemParameters.
rules (2.google.api.SystemParameterRule"X
SystemParameterRule
selector ( /
parameters (2.google.api.SystemParameter"Q
SystemParameter
name (
http_header (
url_query_parameter ( Bv
com.google.apiBSystemParameterProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Usage.php
================================================
internalAddGeneratedFile(
'
google/api/usage.proto
google.api"j
Usage
requirements ( $
rules (2.google.api.UsageRule%
producer_notification_channel ( "]
UsageRule
selector (
allow_unregistered_calls (
skip_service_control (Bl
com.google.apiB
UsageProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Api/Visibility.php
================================================
internalAddGeneratedFile(
'
google/api/visibility.proto
google.api google/protobuf/descriptor.proto"7
Visibility)
rules (2.google.api.VisibilityRule"7
VisibilityRule
selector (
restriction ( Bk
com.google.apiBVisibilityProtoPZ?google.golang.org/genproto/googleapis/api/visibility;visibilityGAPIbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Cloud/Location/Locations.php
================================================
internalAddGeneratedFile(
'
%google/cloud/location/locations.protogoogle.cloud.locationgoogle/protobuf/any.protogoogle/api/client.proto"[
ListLocationsRequest
name (
filter (
page_size (
page_token ( "d
ListLocationsResponse2
locations (2.google.cloud.location.Location
next_page_token ( ""
GetLocationRequest
name ( "
Location
name (
location_id (
display_name ( ;
labels (2+.google.cloud.location.Location.LabelsEntry&
metadata (2.google.protobuf.Any-
LabelsEntry
key (
value ( :82
Locations
ListLocations+.google.cloud.location.ListLocationsRequest,.google.cloud.location.ListLocationsResponse"?9/v1/{name=locations}Z!/v1/{name=projects/*}/locations
GetLocation).google.cloud.location.GetLocationRequest.google.cloud.location.Location"C=/v1/{name=locations/*}Z#!/v1/{name=projects/*/locations/*}HAcloud.googleapis.comA.https://www.googleapis.com/auth/cloud-platformBo
com.google.cloud.locationBLocationsProtoPZ=google.golang.org/genproto/googleapis/cloud/location;locationbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Google/Iam/V1/IamPolicy.php
================================================
internalAddGeneratedFile(
'
google/iam/v1/iam_policy.proto
google.iam.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/iam/v1/options.protogoogle/iam/v1/policy.proto google/protobuf/field_mask.proto"
SetIamPolicyRequest
resource ( B AA
**
policy (2.google.iam.v1.PolicyBA/
update_mask (2.google.protobuf.FieldMask"d
GetIamPolicyRequest
resource ( B AA
*0
options (2.google.iam.v1.GetPolicyOptions"R
TestIamPermissionsRequest
resource ( B AA
*
permissions ( BA"1
TestIamPermissionsResponse
permissions ( 2
IAMPolicyt
SetIamPolicy".google.iam.v1.SetIamPolicyRequest.google.iam.v1.Policy")#"/v1/{resource=**}:setIamPolicy:*t
GetIamPolicy".google.iam.v1.GetIamPolicyRequest.google.iam.v1.Policy")#"/v1/{resource=**}:getIamPolicy:*
TestIamPermissions(.google.iam.v1.TestIamPermissionsRequest).google.iam.v1.TestIamPermissionsResponse"/)"$/v1/{resource=**}:testIamPermissions:*Aiam-meta-api.googleapis.comB|
com.google.iam.v1BIamPolicyProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Google/Iam/V1/Logging/AuditData.php
================================================
internalAddGeneratedFile(
'
&google/iam/v1/logging/audit_data.protogoogle.iam.v1.logging"=
AuditData0
policy_delta (2.google.iam.v1.PolicyDeltaB
com.google.iam.v1.loggingBAuditDataProtoPZ9cloud.google.com/go/iam/apiv1/logging/loggingpb;loggingpbGoogle.Cloud.Iam.V1.Loggingbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Google/Iam/V1/Options.php
================================================
internalAddGeneratedFile(
'
google/iam/v1/options.proto
google.iam.v1"4
GetPolicyOptions
requested_policy_version (B}
com.google.iam.v1BOptionsProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Google/Iam/V1/ResourcePolicyMember.php
================================================
internalAddGeneratedFile(
'
*google/iam/v1/resource_policy_member.proto
google.iam.v1"e
ResourcePolicyMember&
iam_policy_name_principal ( BA%
iam_policy_uid_principal ( BAB
com.google.iam.v1BResourcePolicyMemberProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Google/Logging/Type/HttpRequest.php
================================================
internalAddGeneratedFile(
'
&google/logging/type/http_request.protogoogle.logging.type"
HttpRequest
request_method (
request_url (
request_size (
status (
response_size (
user_agent (
remote_ip (
server_ip
(
referer ( *
latency (2.google.protobuf.Duration
cache_lookup (
cache_hit (*
"cache_validated_with_origin_server
(
cache_fill_bytes (
protocol ( B
com.google.logging.typeBHttpRequestProtoPZ8google.golang.org/genproto/googleapis/logging/type;ltypeGoogle.Cloud.Logging.TypeGoogle\\Cloud\\Logging\\TypeGoogle::Cloud::Logging::Typebproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Iam/V1/IamPolicy.php
================================================
internalAddGeneratedFile(
'
google/iam/v1/iam_policy.proto
google.iam.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/iam/v1/options.protogoogle/iam/v1/policy.proto google/protobuf/field_mask.proto"
SetIamPolicyRequest
resource ( B AA
**
policy (2.google.iam.v1.PolicyBA/
update_mask (2.google.protobuf.FieldMask"d
GetIamPolicyRequest
resource ( B AA
*0
options (2.google.iam.v1.GetPolicyOptions"R
TestIamPermissionsRequest
resource ( B AA
*
permissions ( BA"1
TestIamPermissionsResponse
permissions ( 2
IAMPolicyt
SetIamPolicy".google.iam.v1.SetIamPolicyRequest.google.iam.v1.Policy")#"/v1/{resource=**}:setIamPolicy:*t
GetIamPolicy".google.iam.v1.GetIamPolicyRequest.google.iam.v1.Policy")#"/v1/{resource=**}:getIamPolicy:*
TestIamPermissions(.google.iam.v1.TestIamPermissionsRequest).google.iam.v1.TestIamPermissionsResponse"/)"$/v1/{resource=**}:testIamPermissions:*Aiam-meta-api.googleapis.comB|
com.google.iam.v1BIamPolicyProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Iam/V1/Logging/AuditData.php
================================================
internalAddGeneratedFile(
'
&google/iam/v1/logging/audit_data.protogoogle.iam.v1.logging"=
AuditData0
policy_delta (2.google.iam.v1.PolicyDeltaB
com.google.iam.v1.loggingBAuditDataProtoPZ9cloud.google.com/go/iam/apiv1/logging/loggingpb;loggingpbGoogle.Cloud.Iam.V1.Loggingbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Iam/V1/Options.php
================================================
internalAddGeneratedFile(
'
google/iam/v1/options.proto
google.iam.v1"4
GetPolicyOptions
requested_policy_version (B}
com.google.iam.v1BOptionsProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Iam/V1/ResourcePolicyMember.php
================================================
internalAddGeneratedFile(
'
*google/iam/v1/resource_policy_member.proto
google.iam.v1"e
ResourcePolicyMember&
iam_policy_name_principal ( BA%
iam_policy_uid_principal ( BAB
com.google.iam.v1BResourcePolicyMemberProtoPZ)cloud.google.com/go/iam/apiv1/iampb;iampbGoogle.Cloud.Iam.V1Google\\Cloud\\Iam\\V1bproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Logging/Type/HttpRequest.php
================================================
internalAddGeneratedFile(
'
&google/logging/type/http_request.protogoogle.logging.type"
HttpRequest
request_method (
request_url (
request_size (
status (
response_size (
user_agent (
remote_ip (
server_ip
(
referer ( *
latency (2.google.protobuf.Duration
cache_lookup (
cache_hit (*
"cache_validated_with_origin_server
(
cache_fill_bytes (
protocol ( B
com.google.logging.typeBHttpRequestProtoPZ8google.golang.org/genproto/googleapis/logging/type;ltypeGoogle.Cloud.Logging.TypeGoogle\\Cloud\\Logging\\TypeGoogle::Cloud::Logging::Typebproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Rpc/Context/AttributeContext.php
================================================
internalAddGeneratedFile(
'
*google/rpc/context/attribute_context.protogoogle.rpc.contextgoogle/protobuf/duration.protogoogle/protobuf/struct.protogoogle/protobuf/timestamp.proto"
AttributeContext9
origin (2).google.rpc.context.AttributeContext.Peer9
source (2).google.rpc.context.AttributeContext.Peer>
destination (2).google.rpc.context.AttributeContext.Peer=
request (2,.google.rpc.context.AttributeContext.Request?
response (2-.google.rpc.context.AttributeContext.Response?
resource (2-.google.rpc.context.AttributeContext.Resource5
api (2(.google.rpc.context.AttributeContext.Api(
extensions (2.google.protobuf.Any
Peer
ip (
port (E
labels (25.google.rpc.context.AttributeContext.Peer.LabelsEntry
principal (
region_code ( -
LabelsEntry
key (
value ( :8L
Api
service (
operation (
protocol (
version (
Auth
principal (
audiences (
presenter ( \'
claims (2.google.protobuf.Struct
access_levels (
Request
id (
method ( J
headers (29.google.rpc.context.AttributeContext.Request.HeadersEntry
path (
host (
scheme (
query ( (
time (2.google.protobuf.Timestamp
size
(
protocol (
reason ( 7
auth
(2).google.rpc.context.AttributeContext.Auth.
HeadersEntry
key (
value ( :8
Response
code (
size (K
headers (2:.google.rpc.context.AttributeContext.Response.HeadersEntry(
time (2.google.protobuf.Timestamp2
backend_latency (2.google.protobuf.Duration.
HeadersEntry
key (
value ( :8
Resource
service (
name (
type ( I
labels (29.google.rpc.context.AttributeContext.Resource.LabelsEntry
uid ( S
annotations (2>.google.rpc.context.AttributeContext.Resource.AnnotationsEntry
display_name ( /
create_time (2.google.protobuf.Timestamp/
update_time (2.google.protobuf.Timestamp/
delete_time
(2.google.protobuf.Timestamp
etag (
location ( -
LabelsEntry
key (
value ( :82
AnnotationsEntry
key (
value ( :8B
com.google.rpc.contextBAttributeContextProtoPZUgoogle.golang.org/genproto/googleapis/rpc/context/attribute_context;attribute_contextbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Rpc/Context/AuditContext.php
================================================
internalAddGeneratedFile(
'
&google/rpc/context/audit_context.protogoogle.rpc.context"
AuditContext
audit_log (1
scrubbed_request (2.google.protobuf.Struct2
scrubbed_response (2.google.protobuf.Struct$
scrubbed_response_item_count (
target_resource ( Bh
com.google.rpc.contextBAuditContextProtoPZ9google.golang.org/genproto/googleapis/rpc/context;contextbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Rpc/Status.php
================================================
internalAddGeneratedFile(
'
google/rpc/status.proto
google.rpc"N
Status
code (
message ( %
details (2.google.protobuf.AnyBa
com.google.rpcBStatusProtoPZ7google.golang.org/genproto/googleapis/rpc/status;statusRPCbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Type/Color.php
================================================
internalAddGeneratedFile(
'
google/type/color.protogoogle.type"]
Color
red (
green (
blue (*
alpha (2.google.protobuf.FloatValueB`
com.google.typeB
ColorProtoPZ6google.golang.org/genproto/googleapis/type/color;colorGTPbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Type/Date.php
================================================
internalAddGeneratedFile(
'
google/type/date.protogoogle.type"0
Date
year (
month (
day (B]
com.google.typeB DateProtoPZ4google.golang.org/genproto/googleapis/type/date;dateGTPbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Type/Decimal.php
================================================
internalAddGeneratedFile(
'
google/type/decimal.protogoogle.type"
Decimal
value ( Bf
com.google.typeBDecimalProtoPZ:google.golang.org/genproto/googleapis/type/decimal;decimalGTPbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Type/Expr.php
================================================
internalAddGeneratedFile(
'
google/type/expr.protogoogle.type"P
Expr
expression (
title (
description (
location ( BZ
com.google.typeB ExprProtoPZ4google.golang.org/genproto/googleapis/type/expr;exprGTPbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Type/Fraction.php
================================================
internalAddGeneratedFile(
'
google/type/fraction.protogoogle.type"2
Fraction
numerator (
denominator (Bf
com.google.typeB
FractionProtoPZinternalAddGeneratedFile(
'
google/type/interval.protogoogle.type"h
Interval.
start_time (2.google.protobuf.Timestamp,
end_time (2.google.protobuf.TimestampBi
com.google.typeB
IntervalProtoPZinternalAddGeneratedFile(
'
google/type/latlng.protogoogle.type"-
LatLng
latitude (
longitude (Bc
com.google.typeBLatLngProtoPZ8google.golang.org/genproto/googleapis/type/latlng;latlngGTPbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Type/LocalizedText.php
================================================
internalAddGeneratedFile(
'
google/type/localized_text.protogoogle.type"4
LocalizedText
text (
language_code ( Bz
com.google.typeBLocalizedTextProtoPZHgoogle.golang.org/genproto/googleapis/type/localized_text;localized_textGTPbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Type/Money.php
================================================
internalAddGeneratedFile(
'
google/type/money.protogoogle.type"<
Money
currency_code (
units (
nanos (B`
com.google.typeB
MoneyProtoPZ6google.golang.org/genproto/googleapis/type/money;moneyGTPbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Type/PostalAddress.php
================================================
internalAddGeneratedFile(
'
google/type/postal_address.protogoogle.type"
PostalAddress
revision (
region_code (
language_code (
postal_code (
sorting_code (
administrative_area (
locality (
sublocality (
address_lines (
recipients
(
organization ( Bx
com.google.typeBPostalAddressProtoPZFgoogle.golang.org/genproto/googleapis/type/postaladdress;postaladdressGTPbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Type/Quaternion.php
================================================
internalAddGeneratedFile(
'
google/type/quaternion.protogoogle.type"8
Quaternion
x (
y (
z (
w (Bo
com.google.typeBQuaternionProtoPZ@google.golang.org/genproto/googleapis/type/quaternion;quaternionGTPbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/metadata/Type/Timeofday.php
================================================
internalAddGeneratedFile(
'
google/type/timeofday.protogoogle.type"K
TimeOfDay
hours (
minutes (
seconds (
nanos (Bl
com.google.typeBTimeOfDayProtoPZ>google.golang.org/genproto/googleapis/type/timeofday;timeofdayGTPbproto3'
, true);
static::$is_initialized = true;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/renovate.json
================================================
{
"extends": [
"config:base",
":preserveSemverRanges",
":disableDependencyDashboard"
]
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Advice.php
================================================
google.api.Advice
*/
class Advice extends \Google\Protobuf\Internal\Message
{
/**
* Useful description for why this advice was applied and what actions should
* be taken to mitigate any implied risks.
*
* Generated from protobuf field string description = 2;
*/
protected $description = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $description
* Useful description for why this advice was applied and what actions should
* be taken to mitigate any implied risks.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\ConfigChange::initOnce();
parent::__construct($data);
}
/**
* Useful description for why this advice was applied and what actions should
* be taken to mitigate any implied risks.
*
* Generated from protobuf field string description = 2;
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Useful description for why this advice was applied and what actions should
* be taken to mitigate any implied risks.
*
* Generated from protobuf field string description = 2;
* @param string $var
* @return $this
*/
public function setDescription($var)
{
GPBUtil::checkString($var, True);
$this->description = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/AuthProvider.php
================================================
google.api.AuthProvider
*/
class AuthProvider extends \Google\Protobuf\Internal\Message
{
/**
* The unique identifier of the auth provider. It will be referred to by
* `AuthRequirement.provider_id`.
* Example: "bookstore_auth".
*
* Generated from protobuf field string id = 1;
*/
protected $id = '';
/**
* Identifies the principal that issued the JWT. See
* https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1
* Usually a URL or an email address.
* Example: https://securetoken.google.com
* Example: 1234567-compute@developer.gserviceaccount.com
*
* Generated from protobuf field string issuer = 2;
*/
protected $issuer = '';
/**
* URL of the provider's public key set to validate signature of the JWT. See
* [OpenID
* Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
* Optional if the key set document:
* - can be retrieved from
* [OpenID
* Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
* of the issuer.
* - can be inferred from the email domain of the issuer (e.g. a Google
* service account).
* Example: https://www.googleapis.com/oauth2/v1/certs
*
* Generated from protobuf field string jwks_uri = 3;
*/
protected $jwks_uri = '';
/**
* The list of JWT
* [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
* that are allowed to access. A JWT containing any of these audiences will
* be accepted. When this setting is absent, JWTs with audiences:
* - "https://[service.name]/[google.protobuf.Api.name]"
* - "https://[service.name]/"
* will be accepted.
* For example, if no audiences are in the setting, LibraryService API will
* accept JWTs with the following audiences:
* -
* https://library-example.googleapis.com/google.example.library.v1.LibraryService
* - https://library-example.googleapis.com/
* Example:
* audiences: bookstore_android.apps.googleusercontent.com,
* bookstore_web.apps.googleusercontent.com
*
* Generated from protobuf field string audiences = 4;
*/
protected $audiences = '';
/**
* Redirect URL if JWT token is required but not present or is expired.
* Implement authorizationUrl of securityDefinitions in OpenAPI spec.
*
* Generated from protobuf field string authorization_url = 5;
*/
protected $authorization_url = '';
/**
* Defines the locations to extract the JWT. For now it is only used by the
* Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
* (https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations)
* JWT locations can be one of HTTP headers, URL query parameters or
* cookies. The rule is that the first match wins.
* If not specified, default to use following 3 locations:
* 1) Authorization: Bearer
* 2) x-goog-iap-jwt-assertion
* 3) access_token query parameter
* Default locations can be specified as followings:
* jwt_locations:
* - header: Authorization
* value_prefix: "Bearer "
* - header: x-goog-iap-jwt-assertion
* - query: access_token
*
* Generated from protobuf field repeated .google.api.JwtLocation jwt_locations = 6;
*/
private $jwt_locations;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $id
* The unique identifier of the auth provider. It will be referred to by
* `AuthRequirement.provider_id`.
* Example: "bookstore_auth".
* @type string $issuer
* Identifies the principal that issued the JWT. See
* https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1
* Usually a URL or an email address.
* Example: https://securetoken.google.com
* Example: 1234567-compute@developer.gserviceaccount.com
* @type string $jwks_uri
* URL of the provider's public key set to validate signature of the JWT. See
* [OpenID
* Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
* Optional if the key set document:
* - can be retrieved from
* [OpenID
* Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
* of the issuer.
* - can be inferred from the email domain of the issuer (e.g. a Google
* service account).
* Example: https://www.googleapis.com/oauth2/v1/certs
* @type string $audiences
* The list of JWT
* [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
* that are allowed to access. A JWT containing any of these audiences will
* be accepted. When this setting is absent, JWTs with audiences:
* - "https://[service.name]/[google.protobuf.Api.name]"
* - "https://[service.name]/"
* will be accepted.
* For example, if no audiences are in the setting, LibraryService API will
* accept JWTs with the following audiences:
* -
* https://library-example.googleapis.com/google.example.library.v1.LibraryService
* - https://library-example.googleapis.com/
* Example:
* audiences: bookstore_android.apps.googleusercontent.com,
* bookstore_web.apps.googleusercontent.com
* @type string $authorization_url
* Redirect URL if JWT token is required but not present or is expired.
* Implement authorizationUrl of securityDefinitions in OpenAPI spec.
* @type array<\Google\Api\JwtLocation>|\Google\Protobuf\Internal\RepeatedField $jwt_locations
* Defines the locations to extract the JWT. For now it is only used by the
* Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
* (https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations)
* JWT locations can be one of HTTP headers, URL query parameters or
* cookies. The rule is that the first match wins.
* If not specified, default to use following 3 locations:
* 1) Authorization: Bearer
* 2) x-goog-iap-jwt-assertion
* 3) access_token query parameter
* Default locations can be specified as followings:
* jwt_locations:
* - header: Authorization
* value_prefix: "Bearer "
* - header: x-goog-iap-jwt-assertion
* - query: access_token
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Auth::initOnce();
parent::__construct($data);
}
/**
* The unique identifier of the auth provider. It will be referred to by
* `AuthRequirement.provider_id`.
* Example: "bookstore_auth".
*
* Generated from protobuf field string id = 1;
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The unique identifier of the auth provider. It will be referred to by
* `AuthRequirement.provider_id`.
* Example: "bookstore_auth".
*
* Generated from protobuf field string id = 1;
* @param string $var
* @return $this
*/
public function setId($var)
{
GPBUtil::checkString($var, True);
$this->id = $var;
return $this;
}
/**
* Identifies the principal that issued the JWT. See
* https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1
* Usually a URL or an email address.
* Example: https://securetoken.google.com
* Example: 1234567-compute@developer.gserviceaccount.com
*
* Generated from protobuf field string issuer = 2;
* @return string
*/
public function getIssuer()
{
return $this->issuer;
}
/**
* Identifies the principal that issued the JWT. See
* https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1
* Usually a URL or an email address.
* Example: https://securetoken.google.com
* Example: 1234567-compute@developer.gserviceaccount.com
*
* Generated from protobuf field string issuer = 2;
* @param string $var
* @return $this
*/
public function setIssuer($var)
{
GPBUtil::checkString($var, True);
$this->issuer = $var;
return $this;
}
/**
* URL of the provider's public key set to validate signature of the JWT. See
* [OpenID
* Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
* Optional if the key set document:
* - can be retrieved from
* [OpenID
* Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
* of the issuer.
* - can be inferred from the email domain of the issuer (e.g. a Google
* service account).
* Example: https://www.googleapis.com/oauth2/v1/certs
*
* Generated from protobuf field string jwks_uri = 3;
* @return string
*/
public function getJwksUri()
{
return $this->jwks_uri;
}
/**
* URL of the provider's public key set to validate signature of the JWT. See
* [OpenID
* Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
* Optional if the key set document:
* - can be retrieved from
* [OpenID
* Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
* of the issuer.
* - can be inferred from the email domain of the issuer (e.g. a Google
* service account).
* Example: https://www.googleapis.com/oauth2/v1/certs
*
* Generated from protobuf field string jwks_uri = 3;
* @param string $var
* @return $this
*/
public function setJwksUri($var)
{
GPBUtil::checkString($var, True);
$this->jwks_uri = $var;
return $this;
}
/**
* The list of JWT
* [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
* that are allowed to access. A JWT containing any of these audiences will
* be accepted. When this setting is absent, JWTs with audiences:
* - "https://[service.name]/[google.protobuf.Api.name]"
* - "https://[service.name]/"
* will be accepted.
* For example, if no audiences are in the setting, LibraryService API will
* accept JWTs with the following audiences:
* -
* https://library-example.googleapis.com/google.example.library.v1.LibraryService
* - https://library-example.googleapis.com/
* Example:
* audiences: bookstore_android.apps.googleusercontent.com,
* bookstore_web.apps.googleusercontent.com
*
* Generated from protobuf field string audiences = 4;
* @return string
*/
public function getAudiences()
{
return $this->audiences;
}
/**
* The list of JWT
* [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
* that are allowed to access. A JWT containing any of these audiences will
* be accepted. When this setting is absent, JWTs with audiences:
* - "https://[service.name]/[google.protobuf.Api.name]"
* - "https://[service.name]/"
* will be accepted.
* For example, if no audiences are in the setting, LibraryService API will
* accept JWTs with the following audiences:
* -
* https://library-example.googleapis.com/google.example.library.v1.LibraryService
* - https://library-example.googleapis.com/
* Example:
* audiences: bookstore_android.apps.googleusercontent.com,
* bookstore_web.apps.googleusercontent.com
*
* Generated from protobuf field string audiences = 4;
* @param string $var
* @return $this
*/
public function setAudiences($var)
{
GPBUtil::checkString($var, True);
$this->audiences = $var;
return $this;
}
/**
* Redirect URL if JWT token is required but not present or is expired.
* Implement authorizationUrl of securityDefinitions in OpenAPI spec.
*
* Generated from protobuf field string authorization_url = 5;
* @return string
*/
public function getAuthorizationUrl()
{
return $this->authorization_url;
}
/**
* Redirect URL if JWT token is required but not present or is expired.
* Implement authorizationUrl of securityDefinitions in OpenAPI spec.
*
* Generated from protobuf field string authorization_url = 5;
* @param string $var
* @return $this
*/
public function setAuthorizationUrl($var)
{
GPBUtil::checkString($var, True);
$this->authorization_url = $var;
return $this;
}
/**
* Defines the locations to extract the JWT. For now it is only used by the
* Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
* (https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations)
* JWT locations can be one of HTTP headers, URL query parameters or
* cookies. The rule is that the first match wins.
* If not specified, default to use following 3 locations:
* 1) Authorization: Bearer
* 2) x-goog-iap-jwt-assertion
* 3) access_token query parameter
* Default locations can be specified as followings:
* jwt_locations:
* - header: Authorization
* value_prefix: "Bearer "
* - header: x-goog-iap-jwt-assertion
* - query: access_token
*
* Generated from protobuf field repeated .google.api.JwtLocation jwt_locations = 6;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getJwtLocations()
{
return $this->jwt_locations;
}
/**
* Defines the locations to extract the JWT. For now it is only used by the
* Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
* (https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations)
* JWT locations can be one of HTTP headers, URL query parameters or
* cookies. The rule is that the first match wins.
* If not specified, default to use following 3 locations:
* 1) Authorization: Bearer
* 2) x-goog-iap-jwt-assertion
* 3) access_token query parameter
* Default locations can be specified as followings:
* jwt_locations:
* - header: Authorization
* value_prefix: "Bearer "
* - header: x-goog-iap-jwt-assertion
* - query: access_token
*
* Generated from protobuf field repeated .google.api.JwtLocation jwt_locations = 6;
* @param array<\Google\Api\JwtLocation>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setJwtLocations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\JwtLocation::class);
$this->jwt_locations = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/AuthRequirement.php
================================================
google.api.AuthRequirement
*/
class AuthRequirement extends \Google\Protobuf\Internal\Message
{
/**
* [id][google.api.AuthProvider.id] from authentication provider.
* Example:
* provider_id: bookstore_auth
*
* Generated from protobuf field string provider_id = 1;
*/
protected $provider_id = '';
/**
* NOTE: This will be deprecated soon, once AuthProvider.audiences is
* implemented and accepted in all the runtime components.
* The list of JWT
* [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
* that are allowed to access. A JWT containing any of these audiences will
* be accepted. When this setting is absent, only JWTs with audience
* "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
* will be accepted. For example, if no audiences are in the setting,
* LibraryService API will only accept JWTs with the following audience
* "https://library-example.googleapis.com/google.example.library.v1.LibraryService".
* Example:
* audiences: bookstore_android.apps.googleusercontent.com,
* bookstore_web.apps.googleusercontent.com
*
* Generated from protobuf field string audiences = 2;
*/
protected $audiences = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $provider_id
* [id][google.api.AuthProvider.id] from authentication provider.
* Example:
* provider_id: bookstore_auth
* @type string $audiences
* NOTE: This will be deprecated soon, once AuthProvider.audiences is
* implemented and accepted in all the runtime components.
* The list of JWT
* [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
* that are allowed to access. A JWT containing any of these audiences will
* be accepted. When this setting is absent, only JWTs with audience
* "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
* will be accepted. For example, if no audiences are in the setting,
* LibraryService API will only accept JWTs with the following audience
* "https://library-example.googleapis.com/google.example.library.v1.LibraryService".
* Example:
* audiences: bookstore_android.apps.googleusercontent.com,
* bookstore_web.apps.googleusercontent.com
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Auth::initOnce();
parent::__construct($data);
}
/**
* [id][google.api.AuthProvider.id] from authentication provider.
* Example:
* provider_id: bookstore_auth
*
* Generated from protobuf field string provider_id = 1;
* @return string
*/
public function getProviderId()
{
return $this->provider_id;
}
/**
* [id][google.api.AuthProvider.id] from authentication provider.
* Example:
* provider_id: bookstore_auth
*
* Generated from protobuf field string provider_id = 1;
* @param string $var
* @return $this
*/
public function setProviderId($var)
{
GPBUtil::checkString($var, True);
$this->provider_id = $var;
return $this;
}
/**
* NOTE: This will be deprecated soon, once AuthProvider.audiences is
* implemented and accepted in all the runtime components.
* The list of JWT
* [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
* that are allowed to access. A JWT containing any of these audiences will
* be accepted. When this setting is absent, only JWTs with audience
* "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
* will be accepted. For example, if no audiences are in the setting,
* LibraryService API will only accept JWTs with the following audience
* "https://library-example.googleapis.com/google.example.library.v1.LibraryService".
* Example:
* audiences: bookstore_android.apps.googleusercontent.com,
* bookstore_web.apps.googleusercontent.com
*
* Generated from protobuf field string audiences = 2;
* @return string
*/
public function getAudiences()
{
return $this->audiences;
}
/**
* NOTE: This will be deprecated soon, once AuthProvider.audiences is
* implemented and accepted in all the runtime components.
* The list of JWT
* [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
* that are allowed to access. A JWT containing any of these audiences will
* be accepted. When this setting is absent, only JWTs with audience
* "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
* will be accepted. For example, if no audiences are in the setting,
* LibraryService API will only accept JWTs with the following audience
* "https://library-example.googleapis.com/google.example.library.v1.LibraryService".
* Example:
* audiences: bookstore_android.apps.googleusercontent.com,
* bookstore_web.apps.googleusercontent.com
*
* Generated from protobuf field string audiences = 2;
* @param string $var
* @return $this
*/
public function setAudiences($var)
{
GPBUtil::checkString($var, True);
$this->audiences = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Authentication.php
================================================
google.api.Authentication
*/
class Authentication extends \Google\Protobuf\Internal\Message
{
/**
* A list of authentication rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.AuthenticationRule rules = 3;
*/
private $rules;
/**
* Defines a set of authentication providers that a service supports.
*
* Generated from protobuf field repeated .google.api.AuthProvider providers = 4;
*/
private $providers;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\AuthenticationRule>|\Google\Protobuf\Internal\RepeatedField $rules
* A list of authentication rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
* @type array<\Google\Api\AuthProvider>|\Google\Protobuf\Internal\RepeatedField $providers
* Defines a set of authentication providers that a service supports.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Auth::initOnce();
parent::__construct($data);
}
/**
* A list of authentication rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.AuthenticationRule rules = 3;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getRules()
{
return $this->rules;
}
/**
* A list of authentication rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.AuthenticationRule rules = 3;
* @param array<\Google\Api\AuthenticationRule>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setRules($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthenticationRule::class);
$this->rules = $arr;
return $this;
}
/**
* Defines a set of authentication providers that a service supports.
*
* Generated from protobuf field repeated .google.api.AuthProvider providers = 4;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getProviders()
{
return $this->providers;
}
/**
* Defines a set of authentication providers that a service supports.
*
* Generated from protobuf field repeated .google.api.AuthProvider providers = 4;
* @param array<\Google\Api\AuthProvider>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setProviders($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthProvider::class);
$this->providers = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/AuthenticationRule.php
================================================
google.api.AuthenticationRule
*/
class AuthenticationRule extends \Google\Protobuf\Internal\Message
{
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
*/
protected $selector = '';
/**
* The requirements for OAuth credentials.
*
* Generated from protobuf field .google.api.OAuthRequirements oauth = 2;
*/
protected $oauth = null;
/**
* If true, the service accepts API keys without any other credential.
* This flag only applies to HTTP and gRPC requests.
*
* Generated from protobuf field bool allow_without_credential = 5;
*/
protected $allow_without_credential = false;
/**
* Requirements for additional authentication providers.
*
* Generated from protobuf field repeated .google.api.AuthRequirement requirements = 7;
*/
private $requirements;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $selector
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
* @type \Google\Api\OAuthRequirements $oauth
* The requirements for OAuth credentials.
* @type bool $allow_without_credential
* If true, the service accepts API keys without any other credential.
* This flag only applies to HTTP and gRPC requests.
* @type array<\Google\Api\AuthRequirement>|\Google\Protobuf\Internal\RepeatedField $requirements
* Requirements for additional authentication providers.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Auth::initOnce();
parent::__construct($data);
}
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @return string
*/
public function getSelector()
{
return $this->selector;
}
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @param string $var
* @return $this
*/
public function setSelector($var)
{
GPBUtil::checkString($var, True);
$this->selector = $var;
return $this;
}
/**
* The requirements for OAuth credentials.
*
* Generated from protobuf field .google.api.OAuthRequirements oauth = 2;
* @return \Google\Api\OAuthRequirements|null
*/
public function getOauth()
{
return $this->oauth;
}
public function hasOauth()
{
return isset($this->oauth);
}
public function clearOauth()
{
unset($this->oauth);
}
/**
* The requirements for OAuth credentials.
*
* Generated from protobuf field .google.api.OAuthRequirements oauth = 2;
* @param \Google\Api\OAuthRequirements $var
* @return $this
*/
public function setOauth($var)
{
GPBUtil::checkMessage($var, \Google\Api\OAuthRequirements::class);
$this->oauth = $var;
return $this;
}
/**
* If true, the service accepts API keys without any other credential.
* This flag only applies to HTTP and gRPC requests.
*
* Generated from protobuf field bool allow_without_credential = 5;
* @return bool
*/
public function getAllowWithoutCredential()
{
return $this->allow_without_credential;
}
/**
* If true, the service accepts API keys without any other credential.
* This flag only applies to HTTP and gRPC requests.
*
* Generated from protobuf field bool allow_without_credential = 5;
* @param bool $var
* @return $this
*/
public function setAllowWithoutCredential($var)
{
GPBUtil::checkBool($var);
$this->allow_without_credential = $var;
return $this;
}
/**
* Requirements for additional authentication providers.
*
* Generated from protobuf field repeated .google.api.AuthRequirement requirements = 7;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getRequirements()
{
return $this->requirements;
}
/**
* Requirements for additional authentication providers.
*
* Generated from protobuf field repeated .google.api.AuthRequirement requirements = 7;
* @param array<\Google\Api\AuthRequirement>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setRequirements($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthRequirement::class);
$this->requirements = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Backend.php
================================================
google.api.Backend
*/
class Backend extends \Google\Protobuf\Internal\Message
{
/**
* A list of API backend rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.BackendRule rules = 1;
*/
private $rules;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\BackendRule>|\Google\Protobuf\Internal\RepeatedField $rules
* A list of API backend rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Backend::initOnce();
parent::__construct($data);
}
/**
* A list of API backend rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.BackendRule rules = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getRules()
{
return $this->rules;
}
/**
* A list of API backend rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.BackendRule rules = 1;
* @param array<\Google\Api\BackendRule>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setRules($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\BackendRule::class);
$this->rules = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/BackendRule/PathTranslation.php
================================================
google.api.BackendRule.PathTranslation
*/
class PathTranslation
{
/**
* Generated from protobuf enum PATH_TRANSLATION_UNSPECIFIED = 0;
*/
const PATH_TRANSLATION_UNSPECIFIED = 0;
/**
* Use the backend address as-is, with no modification to the path. If the
* URL pattern contains variables, the variable names and values will be
* appended to the query string. If a query string parameter and a URL
* pattern variable have the same name, this may result in duplicate keys in
* the query string.
* # Examples
* Given the following operation config:
* Method path: /api/company/{cid}/user/{uid}
* Backend address: https://example.cloudfunctions.net/getUser
* Requests to the following request paths will call the backend at the
* translated path:
* Request path: /api/company/widgetworks/user/johndoe
* Translated:
* https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
* Request path: /api/company/widgetworks/user/johndoe?timezone=EST
* Translated:
* https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
*
* Generated from protobuf enum CONSTANT_ADDRESS = 1;
*/
const CONSTANT_ADDRESS = 1;
/**
* The request path will be appended to the backend address.
* # Examples
* Given the following operation config:
* Method path: /api/company/{cid}/user/{uid}
* Backend address: https://example.appspot.com
* Requests to the following request paths will call the backend at the
* translated path:
* Request path: /api/company/widgetworks/user/johndoe
* Translated:
* https://example.appspot.com/api/company/widgetworks/user/johndoe
* Request path: /api/company/widgetworks/user/johndoe?timezone=EST
* Translated:
* https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
*
* Generated from protobuf enum APPEND_PATH_TO_ADDRESS = 2;
*/
const APPEND_PATH_TO_ADDRESS = 2;
private static $valueToName = [
self::PATH_TRANSLATION_UNSPECIFIED => 'PATH_TRANSLATION_UNSPECIFIED',
self::CONSTANT_ADDRESS => 'CONSTANT_ADDRESS',
self::APPEND_PATH_TO_ADDRESS => 'APPEND_PATH_TO_ADDRESS',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/BackendRule.php
================================================
google.api.BackendRule
*/
class BackendRule extends \Google\Protobuf\Internal\Message
{
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
*/
protected $selector = '';
/**
* The address of the API backend.
* The scheme is used to determine the backend protocol and security.
* The following schemes are accepted:
* SCHEME PROTOCOL SECURITY
* http:// HTTP None
* https:// HTTP TLS
* grpc:// gRPC None
* grpcs:// gRPC TLS
* It is recommended to explicitly include a scheme. Leaving out the scheme
* may cause constrasting behaviors across platforms.
* If the port is unspecified, the default is:
* - 80 for schemes without TLS
* - 443 for schemes with TLS
* For HTTP backends, use [protocol][google.api.BackendRule.protocol]
* to specify the protocol version.
*
* Generated from protobuf field string address = 2;
*/
protected $address = '';
/**
* The number of seconds to wait for a response from a request. The default
* varies based on the request protocol and deployment environment.
*
* Generated from protobuf field double deadline = 3;
*/
protected $deadline = 0.0;
/**
* Deprecated, do not use.
*
* Generated from protobuf field double min_deadline = 4 [deprecated = true];
* @deprecated
*/
protected $min_deadline = 0.0;
/**
* The number of seconds to wait for the completion of a long running
* operation. The default is no deadline.
*
* Generated from protobuf field double operation_deadline = 5;
*/
protected $operation_deadline = 0.0;
/**
* Generated from protobuf field .google.api.BackendRule.PathTranslation path_translation = 6;
*/
protected $path_translation = 0;
/**
* The protocol used for sending a request to the backend.
* The supported values are "http/1.1" and "h2".
* The default value is inferred from the scheme in the
* [address][google.api.BackendRule.address] field:
* SCHEME PROTOCOL
* http:// http/1.1
* https:// http/1.1
* grpc:// h2
* grpcs:// h2
* For secure HTTP backends (https://) that support HTTP/2, set this field
* to "h2" for improved performance.
* Configuring this field to non-default values is only supported for secure
* HTTP backends. This field will be ignored for all other backends.
* See
* https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
* for more details on the supported values.
*
* Generated from protobuf field string protocol = 9;
*/
protected $protocol = '';
/**
* The map between request protocol and the backend address.
*
* Generated from protobuf field map overrides_by_request_protocol = 10;
*/
private $overrides_by_request_protocol;
protected $authentication;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $selector
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
* @type string $address
* The address of the API backend.
* The scheme is used to determine the backend protocol and security.
* The following schemes are accepted:
* SCHEME PROTOCOL SECURITY
* http:// HTTP None
* https:// HTTP TLS
* grpc:// gRPC None
* grpcs:// gRPC TLS
* It is recommended to explicitly include a scheme. Leaving out the scheme
* may cause constrasting behaviors across platforms.
* If the port is unspecified, the default is:
* - 80 for schemes without TLS
* - 443 for schemes with TLS
* For HTTP backends, use [protocol][google.api.BackendRule.protocol]
* to specify the protocol version.
* @type float $deadline
* The number of seconds to wait for a response from a request. The default
* varies based on the request protocol and deployment environment.
* @type float $min_deadline
* Deprecated, do not use.
* @type float $operation_deadline
* The number of seconds to wait for the completion of a long running
* operation. The default is no deadline.
* @type int $path_translation
* @type string $jwt_audience
* The JWT audience is used when generating a JWT ID token for the backend.
* This ID token will be added in the HTTP "authorization" header, and sent
* to the backend.
* @type bool $disable_auth
* When disable_auth is true, a JWT ID token won't be generated and the
* original "Authorization" HTTP header will be preserved. If the header is
* used to carry the original token and is expected by the backend, this
* field must be set to true to preserve the header.
* @type string $protocol
* The protocol used for sending a request to the backend.
* The supported values are "http/1.1" and "h2".
* The default value is inferred from the scheme in the
* [address][google.api.BackendRule.address] field:
* SCHEME PROTOCOL
* http:// http/1.1
* https:// http/1.1
* grpc:// h2
* grpcs:// h2
* For secure HTTP backends (https://) that support HTTP/2, set this field
* to "h2" for improved performance.
* Configuring this field to non-default values is only supported for secure
* HTTP backends. This field will be ignored for all other backends.
* See
* https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
* for more details on the supported values.
* @type array|\Google\Protobuf\Internal\MapField $overrides_by_request_protocol
* The map between request protocol and the backend address.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Backend::initOnce();
parent::__construct($data);
}
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @return string
*/
public function getSelector()
{
return $this->selector;
}
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @param string $var
* @return $this
*/
public function setSelector($var)
{
GPBUtil::checkString($var, True);
$this->selector = $var;
return $this;
}
/**
* The address of the API backend.
* The scheme is used to determine the backend protocol and security.
* The following schemes are accepted:
* SCHEME PROTOCOL SECURITY
* http:// HTTP None
* https:// HTTP TLS
* grpc:// gRPC None
* grpcs:// gRPC TLS
* It is recommended to explicitly include a scheme. Leaving out the scheme
* may cause constrasting behaviors across platforms.
* If the port is unspecified, the default is:
* - 80 for schemes without TLS
* - 443 for schemes with TLS
* For HTTP backends, use [protocol][google.api.BackendRule.protocol]
* to specify the protocol version.
*
* Generated from protobuf field string address = 2;
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* The address of the API backend.
* The scheme is used to determine the backend protocol and security.
* The following schemes are accepted:
* SCHEME PROTOCOL SECURITY
* http:// HTTP None
* https:// HTTP TLS
* grpc:// gRPC None
* grpcs:// gRPC TLS
* It is recommended to explicitly include a scheme. Leaving out the scheme
* may cause constrasting behaviors across platforms.
* If the port is unspecified, the default is:
* - 80 for schemes without TLS
* - 443 for schemes with TLS
* For HTTP backends, use [protocol][google.api.BackendRule.protocol]
* to specify the protocol version.
*
* Generated from protobuf field string address = 2;
* @param string $var
* @return $this
*/
public function setAddress($var)
{
GPBUtil::checkString($var, True);
$this->address = $var;
return $this;
}
/**
* The number of seconds to wait for a response from a request. The default
* varies based on the request protocol and deployment environment.
*
* Generated from protobuf field double deadline = 3;
* @return float
*/
public function getDeadline()
{
return $this->deadline;
}
/**
* The number of seconds to wait for a response from a request. The default
* varies based on the request protocol and deployment environment.
*
* Generated from protobuf field double deadline = 3;
* @param float $var
* @return $this
*/
public function setDeadline($var)
{
GPBUtil::checkDouble($var);
$this->deadline = $var;
return $this;
}
/**
* Deprecated, do not use.
*
* Generated from protobuf field double min_deadline = 4 [deprecated = true];
* @return float
* @deprecated
*/
public function getMinDeadline()
{
if ($this->min_deadline !== 0.0) {
@trigger_error('min_deadline is deprecated.', E_USER_DEPRECATED);
}
return $this->min_deadline;
}
/**
* Deprecated, do not use.
*
* Generated from protobuf field double min_deadline = 4 [deprecated = true];
* @param float $var
* @return $this
* @deprecated
*/
public function setMinDeadline($var)
{
@trigger_error('min_deadline is deprecated.', E_USER_DEPRECATED);
GPBUtil::checkDouble($var);
$this->min_deadline = $var;
return $this;
}
/**
* The number of seconds to wait for the completion of a long running
* operation. The default is no deadline.
*
* Generated from protobuf field double operation_deadline = 5;
* @return float
*/
public function getOperationDeadline()
{
return $this->operation_deadline;
}
/**
* The number of seconds to wait for the completion of a long running
* operation. The default is no deadline.
*
* Generated from protobuf field double operation_deadline = 5;
* @param float $var
* @return $this
*/
public function setOperationDeadline($var)
{
GPBUtil::checkDouble($var);
$this->operation_deadline = $var;
return $this;
}
/**
* Generated from protobuf field .google.api.BackendRule.PathTranslation path_translation = 6;
* @return int
*/
public function getPathTranslation()
{
return $this->path_translation;
}
/**
* Generated from protobuf field .google.api.BackendRule.PathTranslation path_translation = 6;
* @param int $var
* @return $this
*/
public function setPathTranslation($var)
{
GPBUtil::checkEnum($var, \Google\Api\BackendRule\PathTranslation::class);
$this->path_translation = $var;
return $this;
}
/**
* The JWT audience is used when generating a JWT ID token for the backend.
* This ID token will be added in the HTTP "authorization" header, and sent
* to the backend.
*
* Generated from protobuf field string jwt_audience = 7;
* @return string
*/
public function getJwtAudience()
{
return $this->readOneof(7);
}
public function hasJwtAudience()
{
return $this->hasOneof(7);
}
/**
* The JWT audience is used when generating a JWT ID token for the backend.
* This ID token will be added in the HTTP "authorization" header, and sent
* to the backend.
*
* Generated from protobuf field string jwt_audience = 7;
* @param string $var
* @return $this
*/
public function setJwtAudience($var)
{
GPBUtil::checkString($var, True);
$this->writeOneof(7, $var);
return $this;
}
/**
* When disable_auth is true, a JWT ID token won't be generated and the
* original "Authorization" HTTP header will be preserved. If the header is
* used to carry the original token and is expected by the backend, this
* field must be set to true to preserve the header.
*
* Generated from protobuf field bool disable_auth = 8;
* @return bool
*/
public function getDisableAuth()
{
return $this->readOneof(8);
}
public function hasDisableAuth()
{
return $this->hasOneof(8);
}
/**
* When disable_auth is true, a JWT ID token won't be generated and the
* original "Authorization" HTTP header will be preserved. If the header is
* used to carry the original token and is expected by the backend, this
* field must be set to true to preserve the header.
*
* Generated from protobuf field bool disable_auth = 8;
* @param bool $var
* @return $this
*/
public function setDisableAuth($var)
{
GPBUtil::checkBool($var);
$this->writeOneof(8, $var);
return $this;
}
/**
* The protocol used for sending a request to the backend.
* The supported values are "http/1.1" and "h2".
* The default value is inferred from the scheme in the
* [address][google.api.BackendRule.address] field:
* SCHEME PROTOCOL
* http:// http/1.1
* https:// http/1.1
* grpc:// h2
* grpcs:// h2
* For secure HTTP backends (https://) that support HTTP/2, set this field
* to "h2" for improved performance.
* Configuring this field to non-default values is only supported for secure
* HTTP backends. This field will be ignored for all other backends.
* See
* https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
* for more details on the supported values.
*
* Generated from protobuf field string protocol = 9;
* @return string
*/
public function getProtocol()
{
return $this->protocol;
}
/**
* The protocol used for sending a request to the backend.
* The supported values are "http/1.1" and "h2".
* The default value is inferred from the scheme in the
* [address][google.api.BackendRule.address] field:
* SCHEME PROTOCOL
* http:// http/1.1
* https:// http/1.1
* grpc:// h2
* grpcs:// h2
* For secure HTTP backends (https://) that support HTTP/2, set this field
* to "h2" for improved performance.
* Configuring this field to non-default values is only supported for secure
* HTTP backends. This field will be ignored for all other backends.
* See
* https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
* for more details on the supported values.
*
* Generated from protobuf field string protocol = 9;
* @param string $var
* @return $this
*/
public function setProtocol($var)
{
GPBUtil::checkString($var, True);
$this->protocol = $var;
return $this;
}
/**
* The map between request protocol and the backend address.
*
* Generated from protobuf field map overrides_by_request_protocol = 10;
* @return \Google\Protobuf\Internal\MapField
*/
public function getOverridesByRequestProtocol()
{
return $this->overrides_by_request_protocol;
}
/**
* The map between request protocol and the backend address.
*
* Generated from protobuf field map overrides_by_request_protocol = 10;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setOverridesByRequestProtocol($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\BackendRule::class);
$this->overrides_by_request_protocol = $arr;
return $this;
}
/**
* @return string
*/
public function getAuthentication()
{
return $this->whichOneof("authentication");
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Billing/BillingDestination.php
================================================
google.api.Billing.BillingDestination
*/
class BillingDestination extends \Google\Protobuf\Internal\Message
{
/**
* The monitored resource type. The type must be defined in
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
*
* Generated from protobuf field string monitored_resource = 1;
*/
protected $monitored_resource = '';
/**
* Names of the metrics to report to this billing destination.
* Each name must be defined in
* [Service.metrics][google.api.Service.metrics] section.
*
* Generated from protobuf field repeated string metrics = 2;
*/
private $metrics;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $monitored_resource
* The monitored resource type. The type must be defined in
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
* @type array|\Google\Protobuf\Internal\RepeatedField $metrics
* Names of the metrics to report to this billing destination.
* Each name must be defined in
* [Service.metrics][google.api.Service.metrics] section.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Billing::initOnce();
parent::__construct($data);
}
/**
* The monitored resource type. The type must be defined in
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
*
* Generated from protobuf field string monitored_resource = 1;
* @return string
*/
public function getMonitoredResource()
{
return $this->monitored_resource;
}
/**
* The monitored resource type. The type must be defined in
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
*
* Generated from protobuf field string monitored_resource = 1;
* @param string $var
* @return $this
*/
public function setMonitoredResource($var)
{
GPBUtil::checkString($var, True);
$this->monitored_resource = $var;
return $this;
}
/**
* Names of the metrics to report to this billing destination.
* Each name must be defined in
* [Service.metrics][google.api.Service.metrics] section.
*
* Generated from protobuf field repeated string metrics = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getMetrics()
{
return $this->metrics;
}
/**
* Names of the metrics to report to this billing destination.
* Each name must be defined in
* [Service.metrics][google.api.Service.metrics] section.
*
* Generated from protobuf field repeated string metrics = 2;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMetrics($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->metrics = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Billing.php
================================================
google.api.Billing
*/
class Billing extends \Google\Protobuf\Internal\Message
{
/**
* Billing configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations per service, each one must have
* a different monitored resource type. A metric can be used in at most
* one consumer destination.
*
* Generated from protobuf field repeated .google.api.Billing.BillingDestination consumer_destinations = 8;
*/
private $consumer_destinations;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\Billing\BillingDestination>|\Google\Protobuf\Internal\RepeatedField $consumer_destinations
* Billing configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations per service, each one must have
* a different monitored resource type. A metric can be used in at most
* one consumer destination.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Billing::initOnce();
parent::__construct($data);
}
/**
* Billing configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations per service, each one must have
* a different monitored resource type. A metric can be used in at most
* one consumer destination.
*
* Generated from protobuf field repeated .google.api.Billing.BillingDestination consumer_destinations = 8;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getConsumerDestinations()
{
return $this->consumer_destinations;
}
/**
* Billing configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations per service, each one must have
* a different monitored resource type. A metric can be used in at most
* one consumer destination.
*
* Generated from protobuf field repeated .google.api.Billing.BillingDestination consumer_destinations = 8;
* @param array<\Google\Api\Billing\BillingDestination>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setConsumerDestinations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Billing\BillingDestination::class);
$this->consumer_destinations = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ChangeType.php
================================================
google.api.ChangeType
*/
class ChangeType
{
/**
* No value was provided.
*
* Generated from protobuf enum CHANGE_TYPE_UNSPECIFIED = 0;
*/
const CHANGE_TYPE_UNSPECIFIED = 0;
/**
* The changed object exists in the 'new' service configuration, but not
* in the 'old' service configuration.
*
* Generated from protobuf enum ADDED = 1;
*/
const ADDED = 1;
/**
* The changed object exists in the 'old' service configuration, but not
* in the 'new' service configuration.
*
* Generated from protobuf enum REMOVED = 2;
*/
const REMOVED = 2;
/**
* The changed object exists in both service configurations, but its value
* is different.
*
* Generated from protobuf enum MODIFIED = 3;
*/
const MODIFIED = 3;
private static $valueToName = [
self::CHANGE_TYPE_UNSPECIFIED => 'CHANGE_TYPE_UNSPECIFIED',
self::ADDED => 'ADDED',
self::REMOVED => 'REMOVED',
self::MODIFIED => 'MODIFIED',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ClientLibraryDestination.php
================================================
google.api.ClientLibraryDestination
*/
class ClientLibraryDestination
{
/**
* Client libraries will neither be generated nor published to package
* managers.
*
* Generated from protobuf enum CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0;
*/
const CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0;
/**
* Generate the client library in a repo under github.com/googleapis,
* but don't publish it to package managers.
*
* Generated from protobuf enum GITHUB = 10;
*/
const GITHUB = 10;
/**
* Publish the library to package managers like nuget.org and npmjs.com.
*
* Generated from protobuf enum PACKAGE_MANAGER = 20;
*/
const PACKAGE_MANAGER = 20;
private static $valueToName = [
self::CLIENT_LIBRARY_DESTINATION_UNSPECIFIED => 'CLIENT_LIBRARY_DESTINATION_UNSPECIFIED',
self::GITHUB => 'GITHUB',
self::PACKAGE_MANAGER => 'PACKAGE_MANAGER',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ClientLibraryOrganization.php
================================================
google.api.ClientLibraryOrganization
*/
class ClientLibraryOrganization
{
/**
* Not useful.
*
* Generated from protobuf enum CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0;
*/
const CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0;
/**
* Google Cloud Platform Org.
*
* Generated from protobuf enum CLOUD = 1;
*/
const CLOUD = 1;
/**
* Ads (Advertising) Org.
*
* Generated from protobuf enum ADS = 2;
*/
const ADS = 2;
/**
* Photos Org.
*
* Generated from protobuf enum PHOTOS = 3;
*/
const PHOTOS = 3;
/**
* Street View Org.
*
* Generated from protobuf enum STREET_VIEW = 4;
*/
const STREET_VIEW = 4;
/**
* Shopping Org.
*
* Generated from protobuf enum SHOPPING = 5;
*/
const SHOPPING = 5;
/**
* Geo Org.
*
* Generated from protobuf enum GEO = 6;
*/
const GEO = 6;
/**
* Generative AI - https://developers.generativeai.google
*
* Generated from protobuf enum GENERATIVE_AI = 7;
*/
const GENERATIVE_AI = 7;
private static $valueToName = [
self::CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED => 'CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED',
self::CLOUD => 'CLOUD',
self::ADS => 'ADS',
self::PHOTOS => 'PHOTOS',
self::STREET_VIEW => 'STREET_VIEW',
self::SHOPPING => 'SHOPPING',
self::GEO => 'GEO',
self::GENERATIVE_AI => 'GENERATIVE_AI',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ClientLibrarySettings.php
================================================
google.api.ClientLibrarySettings
*/
class ClientLibrarySettings extends \Google\Protobuf\Internal\Message
{
/**
* Version of the API to apply these settings to. This is the full protobuf
* package for the API, ending in the version element.
* Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
*
* Generated from protobuf field string version = 1;
*/
protected $version = '';
/**
* Launch stage of this version of the API.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 2;
*/
protected $launch_stage = 0;
/**
* When using transport=rest, the client request will encode enums as
* numbers rather than strings.
*
* Generated from protobuf field bool rest_numeric_enums = 3;
*/
protected $rest_numeric_enums = false;
/**
* Settings for legacy Java features, supported in the Service YAML.
*
* Generated from protobuf field .google.api.JavaSettings java_settings = 21;
*/
protected $java_settings = null;
/**
* Settings for C++ client libraries.
*
* Generated from protobuf field .google.api.CppSettings cpp_settings = 22;
*/
protected $cpp_settings = null;
/**
* Settings for PHP client libraries.
*
* Generated from protobuf field .google.api.PhpSettings php_settings = 23;
*/
protected $php_settings = null;
/**
* Settings for Python client libraries.
*
* Generated from protobuf field .google.api.PythonSettings python_settings = 24;
*/
protected $python_settings = null;
/**
* Settings for Node client libraries.
*
* Generated from protobuf field .google.api.NodeSettings node_settings = 25;
*/
protected $node_settings = null;
/**
* Settings for .NET client libraries.
*
* Generated from protobuf field .google.api.DotnetSettings dotnet_settings = 26;
*/
protected $dotnet_settings = null;
/**
* Settings for Ruby client libraries.
*
* Generated from protobuf field .google.api.RubySettings ruby_settings = 27;
*/
protected $ruby_settings = null;
/**
* Settings for Go client libraries.
*
* Generated from protobuf field .google.api.GoSettings go_settings = 28;
*/
protected $go_settings = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $version
* Version of the API to apply these settings to. This is the full protobuf
* package for the API, ending in the version element.
* Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
* @type int $launch_stage
* Launch stage of this version of the API.
* @type bool $rest_numeric_enums
* When using transport=rest, the client request will encode enums as
* numbers rather than strings.
* @type \Google\Api\JavaSettings $java_settings
* Settings for legacy Java features, supported in the Service YAML.
* @type \Google\Api\CppSettings $cpp_settings
* Settings for C++ client libraries.
* @type \Google\Api\PhpSettings $php_settings
* Settings for PHP client libraries.
* @type \Google\Api\PythonSettings $python_settings
* Settings for Python client libraries.
* @type \Google\Api\NodeSettings $node_settings
* Settings for Node client libraries.
* @type \Google\Api\DotnetSettings $dotnet_settings
* Settings for .NET client libraries.
* @type \Google\Api\RubySettings $ruby_settings
* Settings for Ruby client libraries.
* @type \Google\Api\GoSettings $go_settings
* Settings for Go client libraries.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Version of the API to apply these settings to. This is the full protobuf
* package for the API, ending in the version element.
* Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
*
* Generated from protobuf field string version = 1;
* @return string
*/
public function getVersion()
{
return $this->version;
}
/**
* Version of the API to apply these settings to. This is the full protobuf
* package for the API, ending in the version element.
* Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
*
* Generated from protobuf field string version = 1;
* @param string $var
* @return $this
*/
public function setVersion($var)
{
GPBUtil::checkString($var, True);
$this->version = $var;
return $this;
}
/**
* Launch stage of this version of the API.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 2;
* @return int
*/
public function getLaunchStage()
{
return $this->launch_stage;
}
/**
* Launch stage of this version of the API.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 2;
* @param int $var
* @return $this
*/
public function setLaunchStage($var)
{
GPBUtil::checkEnum($var, \Google\Api\LaunchStage::class);
$this->launch_stage = $var;
return $this;
}
/**
* When using transport=rest, the client request will encode enums as
* numbers rather than strings.
*
* Generated from protobuf field bool rest_numeric_enums = 3;
* @return bool
*/
public function getRestNumericEnums()
{
return $this->rest_numeric_enums;
}
/**
* When using transport=rest, the client request will encode enums as
* numbers rather than strings.
*
* Generated from protobuf field bool rest_numeric_enums = 3;
* @param bool $var
* @return $this
*/
public function setRestNumericEnums($var)
{
GPBUtil::checkBool($var);
$this->rest_numeric_enums = $var;
return $this;
}
/**
* Settings for legacy Java features, supported in the Service YAML.
*
* Generated from protobuf field .google.api.JavaSettings java_settings = 21;
* @return \Google\Api\JavaSettings|null
*/
public function getJavaSettings()
{
return $this->java_settings;
}
public function hasJavaSettings()
{
return isset($this->java_settings);
}
public function clearJavaSettings()
{
unset($this->java_settings);
}
/**
* Settings for legacy Java features, supported in the Service YAML.
*
* Generated from protobuf field .google.api.JavaSettings java_settings = 21;
* @param \Google\Api\JavaSettings $var
* @return $this
*/
public function setJavaSettings($var)
{
GPBUtil::checkMessage($var, \Google\Api\JavaSettings::class);
$this->java_settings = $var;
return $this;
}
/**
* Settings for C++ client libraries.
*
* Generated from protobuf field .google.api.CppSettings cpp_settings = 22;
* @return \Google\Api\CppSettings|null
*/
public function getCppSettings()
{
return $this->cpp_settings;
}
public function hasCppSettings()
{
return isset($this->cpp_settings);
}
public function clearCppSettings()
{
unset($this->cpp_settings);
}
/**
* Settings for C++ client libraries.
*
* Generated from protobuf field .google.api.CppSettings cpp_settings = 22;
* @param \Google\Api\CppSettings $var
* @return $this
*/
public function setCppSettings($var)
{
GPBUtil::checkMessage($var, \Google\Api\CppSettings::class);
$this->cpp_settings = $var;
return $this;
}
/**
* Settings for PHP client libraries.
*
* Generated from protobuf field .google.api.PhpSettings php_settings = 23;
* @return \Google\Api\PhpSettings|null
*/
public function getPhpSettings()
{
return $this->php_settings;
}
public function hasPhpSettings()
{
return isset($this->php_settings);
}
public function clearPhpSettings()
{
unset($this->php_settings);
}
/**
* Settings for PHP client libraries.
*
* Generated from protobuf field .google.api.PhpSettings php_settings = 23;
* @param \Google\Api\PhpSettings $var
* @return $this
*/
public function setPhpSettings($var)
{
GPBUtil::checkMessage($var, \Google\Api\PhpSettings::class);
$this->php_settings = $var;
return $this;
}
/**
* Settings for Python client libraries.
*
* Generated from protobuf field .google.api.PythonSettings python_settings = 24;
* @return \Google\Api\PythonSettings|null
*/
public function getPythonSettings()
{
return $this->python_settings;
}
public function hasPythonSettings()
{
return isset($this->python_settings);
}
public function clearPythonSettings()
{
unset($this->python_settings);
}
/**
* Settings for Python client libraries.
*
* Generated from protobuf field .google.api.PythonSettings python_settings = 24;
* @param \Google\Api\PythonSettings $var
* @return $this
*/
public function setPythonSettings($var)
{
GPBUtil::checkMessage($var, \Google\Api\PythonSettings::class);
$this->python_settings = $var;
return $this;
}
/**
* Settings for Node client libraries.
*
* Generated from protobuf field .google.api.NodeSettings node_settings = 25;
* @return \Google\Api\NodeSettings|null
*/
public function getNodeSettings()
{
return $this->node_settings;
}
public function hasNodeSettings()
{
return isset($this->node_settings);
}
public function clearNodeSettings()
{
unset($this->node_settings);
}
/**
* Settings for Node client libraries.
*
* Generated from protobuf field .google.api.NodeSettings node_settings = 25;
* @param \Google\Api\NodeSettings $var
* @return $this
*/
public function setNodeSettings($var)
{
GPBUtil::checkMessage($var, \Google\Api\NodeSettings::class);
$this->node_settings = $var;
return $this;
}
/**
* Settings for .NET client libraries.
*
* Generated from protobuf field .google.api.DotnetSettings dotnet_settings = 26;
* @return \Google\Api\DotnetSettings|null
*/
public function getDotnetSettings()
{
return $this->dotnet_settings;
}
public function hasDotnetSettings()
{
return isset($this->dotnet_settings);
}
public function clearDotnetSettings()
{
unset($this->dotnet_settings);
}
/**
* Settings for .NET client libraries.
*
* Generated from protobuf field .google.api.DotnetSettings dotnet_settings = 26;
* @param \Google\Api\DotnetSettings $var
* @return $this
*/
public function setDotnetSettings($var)
{
GPBUtil::checkMessage($var, \Google\Api\DotnetSettings::class);
$this->dotnet_settings = $var;
return $this;
}
/**
* Settings for Ruby client libraries.
*
* Generated from protobuf field .google.api.RubySettings ruby_settings = 27;
* @return \Google\Api\RubySettings|null
*/
public function getRubySettings()
{
return $this->ruby_settings;
}
public function hasRubySettings()
{
return isset($this->ruby_settings);
}
public function clearRubySettings()
{
unset($this->ruby_settings);
}
/**
* Settings for Ruby client libraries.
*
* Generated from protobuf field .google.api.RubySettings ruby_settings = 27;
* @param \Google\Api\RubySettings $var
* @return $this
*/
public function setRubySettings($var)
{
GPBUtil::checkMessage($var, \Google\Api\RubySettings::class);
$this->ruby_settings = $var;
return $this;
}
/**
* Settings for Go client libraries.
*
* Generated from protobuf field .google.api.GoSettings go_settings = 28;
* @return \Google\Api\GoSettings|null
*/
public function getGoSettings()
{
return $this->go_settings;
}
public function hasGoSettings()
{
return isset($this->go_settings);
}
public function clearGoSettings()
{
unset($this->go_settings);
}
/**
* Settings for Go client libraries.
*
* Generated from protobuf field .google.api.GoSettings go_settings = 28;
* @param \Google\Api\GoSettings $var
* @return $this
*/
public function setGoSettings($var)
{
GPBUtil::checkMessage($var, \Google\Api\GoSettings::class);
$this->go_settings = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/CommonLanguageSettings.php
================================================
google.api.CommonLanguageSettings
*/
class CommonLanguageSettings extends \Google\Protobuf\Internal\Message
{
/**
* Link to automatically generated reference documentation. Example:
* https://cloud.google.com/nodejs/docs/reference/asset/latest
*
* Generated from protobuf field string reference_docs_uri = 1 [deprecated = true];
* @deprecated
*/
protected $reference_docs_uri = '';
/**
* The destination where API teams want this client library to be published.
*
* Generated from protobuf field repeated .google.api.ClientLibraryDestination destinations = 2;
*/
private $destinations;
/**
* Configuration for which RPCs should be generated in the GAPIC client.
*
* Generated from protobuf field .google.api.SelectiveGapicGeneration selective_gapic_generation = 3;
*/
protected $selective_gapic_generation = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $reference_docs_uri
* Link to automatically generated reference documentation. Example:
* https://cloud.google.com/nodejs/docs/reference/asset/latest
* @type array|\Google\Protobuf\Internal\RepeatedField $destinations
* The destination where API teams want this client library to be published.
* @type \Google\Api\SelectiveGapicGeneration $selective_gapic_generation
* Configuration for which RPCs should be generated in the GAPIC client.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Link to automatically generated reference documentation. Example:
* https://cloud.google.com/nodejs/docs/reference/asset/latest
*
* Generated from protobuf field string reference_docs_uri = 1 [deprecated = true];
* @return string
* @deprecated
*/
public function getReferenceDocsUri()
{
if ($this->reference_docs_uri !== '') {
@trigger_error('reference_docs_uri is deprecated.', E_USER_DEPRECATED);
}
return $this->reference_docs_uri;
}
/**
* Link to automatically generated reference documentation. Example:
* https://cloud.google.com/nodejs/docs/reference/asset/latest
*
* Generated from protobuf field string reference_docs_uri = 1 [deprecated = true];
* @param string $var
* @return $this
* @deprecated
*/
public function setReferenceDocsUri($var)
{
@trigger_error('reference_docs_uri is deprecated.', E_USER_DEPRECATED);
GPBUtil::checkString($var, True);
$this->reference_docs_uri = $var;
return $this;
}
/**
* The destination where API teams want this client library to be published.
*
* Generated from protobuf field repeated .google.api.ClientLibraryDestination destinations = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getDestinations()
{
return $this->destinations;
}
/**
* The destination where API teams want this client library to be published.
*
* Generated from protobuf field repeated .google.api.ClientLibraryDestination destinations = 2;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setDestinations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Api\ClientLibraryDestination::class);
$this->destinations = $arr;
return $this;
}
/**
* Configuration for which RPCs should be generated in the GAPIC client.
*
* Generated from protobuf field .google.api.SelectiveGapicGeneration selective_gapic_generation = 3;
* @return \Google\Api\SelectiveGapicGeneration|null
*/
public function getSelectiveGapicGeneration()
{
return $this->selective_gapic_generation;
}
public function hasSelectiveGapicGeneration()
{
return isset($this->selective_gapic_generation);
}
public function clearSelectiveGapicGeneration()
{
unset($this->selective_gapic_generation);
}
/**
* Configuration for which RPCs should be generated in the GAPIC client.
*
* Generated from protobuf field .google.api.SelectiveGapicGeneration selective_gapic_generation = 3;
* @param \Google\Api\SelectiveGapicGeneration $var
* @return $this
*/
public function setSelectiveGapicGeneration($var)
{
GPBUtil::checkMessage($var, \Google\Api\SelectiveGapicGeneration::class);
$this->selective_gapic_generation = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ConfigChange.php
================================================
google.api.ConfigChange
*/
class ConfigChange extends \Google\Protobuf\Internal\Message
{
/**
* Object hierarchy path to the change, with levels separated by a '.'
* character. For repeated fields, an applicable unique identifier field is
* used for the index (usually selector, name, or id). For maps, the term
* 'key' is used. If the field has no unique identifier, the numeric index
* is used.
* Examples:
* - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
* - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
* - logging.producer_destinations[0]
*
* Generated from protobuf field string element = 1;
*/
protected $element = '';
/**
* Value of the changed object in the old Service configuration,
* in JSON format. This field will not be populated if ChangeType == ADDED.
*
* Generated from protobuf field string old_value = 2;
*/
protected $old_value = '';
/**
* Value of the changed object in the new Service configuration,
* in JSON format. This field will not be populated if ChangeType == REMOVED.
*
* Generated from protobuf field string new_value = 3;
*/
protected $new_value = '';
/**
* The type for this change, either ADDED, REMOVED, or MODIFIED.
*
* Generated from protobuf field .google.api.ChangeType change_type = 4;
*/
protected $change_type = 0;
/**
* Collection of advice provided for this change, useful for determining the
* possible impact of this change.
*
* Generated from protobuf field repeated .google.api.Advice advices = 5;
*/
private $advices;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $element
* Object hierarchy path to the change, with levels separated by a '.'
* character. For repeated fields, an applicable unique identifier field is
* used for the index (usually selector, name, or id). For maps, the term
* 'key' is used. If the field has no unique identifier, the numeric index
* is used.
* Examples:
* - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
* - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
* - logging.producer_destinations[0]
* @type string $old_value
* Value of the changed object in the old Service configuration,
* in JSON format. This field will not be populated if ChangeType == ADDED.
* @type string $new_value
* Value of the changed object in the new Service configuration,
* in JSON format. This field will not be populated if ChangeType == REMOVED.
* @type int $change_type
* The type for this change, either ADDED, REMOVED, or MODIFIED.
* @type array<\Google\Api\Advice>|\Google\Protobuf\Internal\RepeatedField $advices
* Collection of advice provided for this change, useful for determining the
* possible impact of this change.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\ConfigChange::initOnce();
parent::__construct($data);
}
/**
* Object hierarchy path to the change, with levels separated by a '.'
* character. For repeated fields, an applicable unique identifier field is
* used for the index (usually selector, name, or id). For maps, the term
* 'key' is used. If the field has no unique identifier, the numeric index
* is used.
* Examples:
* - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
* - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
* - logging.producer_destinations[0]
*
* Generated from protobuf field string element = 1;
* @return string
*/
public function getElement()
{
return $this->element;
}
/**
* Object hierarchy path to the change, with levels separated by a '.'
* character. For repeated fields, an applicable unique identifier field is
* used for the index (usually selector, name, or id). For maps, the term
* 'key' is used. If the field has no unique identifier, the numeric index
* is used.
* Examples:
* - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
* - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
* - logging.producer_destinations[0]
*
* Generated from protobuf field string element = 1;
* @param string $var
* @return $this
*/
public function setElement($var)
{
GPBUtil::checkString($var, True);
$this->element = $var;
return $this;
}
/**
* Value of the changed object in the old Service configuration,
* in JSON format. This field will not be populated if ChangeType == ADDED.
*
* Generated from protobuf field string old_value = 2;
* @return string
*/
public function getOldValue()
{
return $this->old_value;
}
/**
* Value of the changed object in the old Service configuration,
* in JSON format. This field will not be populated if ChangeType == ADDED.
*
* Generated from protobuf field string old_value = 2;
* @param string $var
* @return $this
*/
public function setOldValue($var)
{
GPBUtil::checkString($var, True);
$this->old_value = $var;
return $this;
}
/**
* Value of the changed object in the new Service configuration,
* in JSON format. This field will not be populated if ChangeType == REMOVED.
*
* Generated from protobuf field string new_value = 3;
* @return string
*/
public function getNewValue()
{
return $this->new_value;
}
/**
* Value of the changed object in the new Service configuration,
* in JSON format. This field will not be populated if ChangeType == REMOVED.
*
* Generated from protobuf field string new_value = 3;
* @param string $var
* @return $this
*/
public function setNewValue($var)
{
GPBUtil::checkString($var, True);
$this->new_value = $var;
return $this;
}
/**
* The type for this change, either ADDED, REMOVED, or MODIFIED.
*
* Generated from protobuf field .google.api.ChangeType change_type = 4;
* @return int
*/
public function getChangeType()
{
return $this->change_type;
}
/**
* The type for this change, either ADDED, REMOVED, or MODIFIED.
*
* Generated from protobuf field .google.api.ChangeType change_type = 4;
* @param int $var
* @return $this
*/
public function setChangeType($var)
{
GPBUtil::checkEnum($var, \Google\Api\ChangeType::class);
$this->change_type = $var;
return $this;
}
/**
* Collection of advice provided for this change, useful for determining the
* possible impact of this change.
*
* Generated from protobuf field repeated .google.api.Advice advices = 5;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getAdvices()
{
return $this->advices;
}
/**
* Collection of advice provided for this change, useful for determining the
* possible impact of this change.
*
* Generated from protobuf field repeated .google.api.Advice advices = 5;
* @param array<\Google\Api\Advice>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setAdvices($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Advice::class);
$this->advices = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Context.php
================================================
-bin” and
* “x-goog-ext--jspb” format. For example, list any service
* specific protobuf types that can appear in grpc metadata as follows in your
* yaml file:
* Example:
* context:
* rules:
* - selector: "google.example.library.v1.LibraryService.CreateBook"
* allowed_request_extensions:
* - google.foo.v1.NewExtension
* allowed_response_extensions:
* - google.foo.v1.NewExtension
* You can also specify extension ID instead of fully qualified extension name
* here.
*
* Generated from protobuf message google.api.Context
*/
class Context extends \Google\Protobuf\Internal\Message
{
/**
* A list of RPC context rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.ContextRule rules = 1;
*/
private $rules;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\ContextRule>|\Google\Protobuf\Internal\RepeatedField $rules
* A list of RPC context rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Context::initOnce();
parent::__construct($data);
}
/**
* A list of RPC context rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.ContextRule rules = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getRules()
{
return $this->rules;
}
/**
* A list of RPC context rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.ContextRule rules = 1;
* @param array<\Google\Api\ContextRule>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setRules($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\ContextRule::class);
$this->rules = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ContextRule.php
================================================
google.api.ContextRule
*/
class ContextRule extends \Google\Protobuf\Internal\Message
{
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
*/
protected $selector = '';
/**
* A list of full type names of requested contexts, only the requested context
* will be made available to the backend.
*
* Generated from protobuf field repeated string requested = 2;
*/
private $requested;
/**
* A list of full type names of provided contexts. It is used to support
* propagating HTTP headers and ETags from the response extension.
*
* Generated from protobuf field repeated string provided = 3;
*/
private $provided;
/**
* A list of full type names or extension IDs of extensions allowed in grpc
* side channel from client to backend.
*
* Generated from protobuf field repeated string allowed_request_extensions = 4;
*/
private $allowed_request_extensions;
/**
* A list of full type names or extension IDs of extensions allowed in grpc
* side channel from backend to client.
*
* Generated from protobuf field repeated string allowed_response_extensions = 5;
*/
private $allowed_response_extensions;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $selector
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
* @type array|\Google\Protobuf\Internal\RepeatedField $requested
* A list of full type names of requested contexts, only the requested context
* will be made available to the backend.
* @type array|\Google\Protobuf\Internal\RepeatedField $provided
* A list of full type names of provided contexts. It is used to support
* propagating HTTP headers and ETags from the response extension.
* @type array|\Google\Protobuf\Internal\RepeatedField $allowed_request_extensions
* A list of full type names or extension IDs of extensions allowed in grpc
* side channel from client to backend.
* @type array|\Google\Protobuf\Internal\RepeatedField $allowed_response_extensions
* A list of full type names or extension IDs of extensions allowed in grpc
* side channel from backend to client.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Context::initOnce();
parent::__construct($data);
}
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @return string
*/
public function getSelector()
{
return $this->selector;
}
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @param string $var
* @return $this
*/
public function setSelector($var)
{
GPBUtil::checkString($var, True);
$this->selector = $var;
return $this;
}
/**
* A list of full type names of requested contexts, only the requested context
* will be made available to the backend.
*
* Generated from protobuf field repeated string requested = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getRequested()
{
return $this->requested;
}
/**
* A list of full type names of requested contexts, only the requested context
* will be made available to the backend.
*
* Generated from protobuf field repeated string requested = 2;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setRequested($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->requested = $arr;
return $this;
}
/**
* A list of full type names of provided contexts. It is used to support
* propagating HTTP headers and ETags from the response extension.
*
* Generated from protobuf field repeated string provided = 3;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getProvided()
{
return $this->provided;
}
/**
* A list of full type names of provided contexts. It is used to support
* propagating HTTP headers and ETags from the response extension.
*
* Generated from protobuf field repeated string provided = 3;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setProvided($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->provided = $arr;
return $this;
}
/**
* A list of full type names or extension IDs of extensions allowed in grpc
* side channel from client to backend.
*
* Generated from protobuf field repeated string allowed_request_extensions = 4;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getAllowedRequestExtensions()
{
return $this->allowed_request_extensions;
}
/**
* A list of full type names or extension IDs of extensions allowed in grpc
* side channel from client to backend.
*
* Generated from protobuf field repeated string allowed_request_extensions = 4;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setAllowedRequestExtensions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->allowed_request_extensions = $arr;
return $this;
}
/**
* A list of full type names or extension IDs of extensions allowed in grpc
* side channel from backend to client.
*
* Generated from protobuf field repeated string allowed_response_extensions = 5;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getAllowedResponseExtensions()
{
return $this->allowed_response_extensions;
}
/**
* A list of full type names or extension IDs of extensions allowed in grpc
* side channel from backend to client.
*
* Generated from protobuf field repeated string allowed_response_extensions = 5;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setAllowedResponseExtensions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->allowed_response_extensions = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Control.php
================================================
google.api.Control
*/
class Control extends \Google\Protobuf\Internal\Message
{
/**
* The service controller environment to use. If empty, no control plane
* feature (like quota and billing) will be enabled. The recommended value for
* most services is servicecontrol.googleapis.com
*
* Generated from protobuf field string environment = 1;
*/
protected $environment = '';
/**
* Defines policies applying to the API methods of the service.
*
* Generated from protobuf field repeated .google.api.MethodPolicy method_policies = 4;
*/
private $method_policies;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $environment
* The service controller environment to use. If empty, no control plane
* feature (like quota and billing) will be enabled. The recommended value for
* most services is servicecontrol.googleapis.com
* @type array<\Google\Api\MethodPolicy>|\Google\Protobuf\Internal\RepeatedField $method_policies
* Defines policies applying to the API methods of the service.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Control::initOnce();
parent::__construct($data);
}
/**
* The service controller environment to use. If empty, no control plane
* feature (like quota and billing) will be enabled. The recommended value for
* most services is servicecontrol.googleapis.com
*
* Generated from protobuf field string environment = 1;
* @return string
*/
public function getEnvironment()
{
return $this->environment;
}
/**
* The service controller environment to use. If empty, no control plane
* feature (like quota and billing) will be enabled. The recommended value for
* most services is servicecontrol.googleapis.com
*
* Generated from protobuf field string environment = 1;
* @param string $var
* @return $this
*/
public function setEnvironment($var)
{
GPBUtil::checkString($var, True);
$this->environment = $var;
return $this;
}
/**
* Defines policies applying to the API methods of the service.
*
* Generated from protobuf field repeated .google.api.MethodPolicy method_policies = 4;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getMethodPolicies()
{
return $this->method_policies;
}
/**
* Defines policies applying to the API methods of the service.
*
* Generated from protobuf field repeated .google.api.MethodPolicy method_policies = 4;
* @param array<\Google\Api\MethodPolicy>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMethodPolicies($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MethodPolicy::class);
$this->method_policies = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/CppSettings.php
================================================
google.api.CppSettings
*/
class CppSettings extends \Google\Protobuf\Internal\Message
{
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
*/
protected $common = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Api\CommonLanguageSettings $common
* Some settings.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @return \Google\Api\CommonLanguageSettings|null
*/
public function getCommon()
{
return $this->common;
}
public function hasCommon()
{
return isset($this->common);
}
public function clearCommon()
{
unset($this->common);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @param \Google\Api\CommonLanguageSettings $var
* @return $this
*/
public function setCommon($var)
{
GPBUtil::checkMessage($var, \Google\Api\CommonLanguageSettings::class);
$this->common = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/CustomHttpPattern.php
================================================
google.api.CustomHttpPattern
*/
class CustomHttpPattern extends \Google\Protobuf\Internal\Message
{
/**
* The name of this custom HTTP verb.
*
* Generated from protobuf field string kind = 1;
*/
protected $kind = '';
/**
* The path matched by this custom verb.
*
* Generated from protobuf field string path = 2;
*/
protected $path = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $kind
* The name of this custom HTTP verb.
* @type string $path
* The path matched by this custom verb.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Http::initOnce();
parent::__construct($data);
}
/**
* The name of this custom HTTP verb.
*
* Generated from protobuf field string kind = 1;
* @return string
*/
public function getKind()
{
return $this->kind;
}
/**
* The name of this custom HTTP verb.
*
* Generated from protobuf field string kind = 1;
* @param string $var
* @return $this
*/
public function setKind($var)
{
GPBUtil::checkString($var, True);
$this->kind = $var;
return $this;
}
/**
* The path matched by this custom verb.
*
* Generated from protobuf field string path = 2;
* @return string
*/
public function getPath()
{
return $this->path;
}
/**
* The path matched by this custom verb.
*
* Generated from protobuf field string path = 2;
* @param string $var
* @return $this
*/
public function setPath($var)
{
GPBUtil::checkString($var, True);
$this->path = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Explicit.php
================================================
google.api.Distribution.BucketOptions.Explicit
*/
class Explicit extends \Google\Protobuf\Internal\Message
{
/**
* The values must be monotonically increasing.
*
* Generated from protobuf field repeated double bounds = 1;
*/
private $bounds;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array|\Google\Protobuf\Internal\RepeatedField $bounds
* The values must be monotonically increasing.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Distribution::initOnce();
parent::__construct($data);
}
/**
* The values must be monotonically increasing.
*
* Generated from protobuf field repeated double bounds = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getBounds()
{
return $this->bounds;
}
/**
* The values must be monotonically increasing.
*
* Generated from protobuf field repeated double bounds = 1;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setBounds($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::DOUBLE);
$this->bounds = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Exponential.php
================================================
google.api.Distribution.BucketOptions.Exponential
*/
class Exponential extends \Google\Protobuf\Internal\Message
{
/**
* Must be greater than 0.
*
* Generated from protobuf field int32 num_finite_buckets = 1;
*/
protected $num_finite_buckets = 0;
/**
* Must be greater than 1.
*
* Generated from protobuf field double growth_factor = 2;
*/
protected $growth_factor = 0.0;
/**
* Must be greater than 0.
*
* Generated from protobuf field double scale = 3;
*/
protected $scale = 0.0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $num_finite_buckets
* Must be greater than 0.
* @type float $growth_factor
* Must be greater than 1.
* @type float $scale
* Must be greater than 0.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Distribution::initOnce();
parent::__construct($data);
}
/**
* Must be greater than 0.
*
* Generated from protobuf field int32 num_finite_buckets = 1;
* @return int
*/
public function getNumFiniteBuckets()
{
return $this->num_finite_buckets;
}
/**
* Must be greater than 0.
*
* Generated from protobuf field int32 num_finite_buckets = 1;
* @param int $var
* @return $this
*/
public function setNumFiniteBuckets($var)
{
GPBUtil::checkInt32($var);
$this->num_finite_buckets = $var;
return $this;
}
/**
* Must be greater than 1.
*
* Generated from protobuf field double growth_factor = 2;
* @return float
*/
public function getGrowthFactor()
{
return $this->growth_factor;
}
/**
* Must be greater than 1.
*
* Generated from protobuf field double growth_factor = 2;
* @param float $var
* @return $this
*/
public function setGrowthFactor($var)
{
GPBUtil::checkDouble($var);
$this->growth_factor = $var;
return $this;
}
/**
* Must be greater than 0.
*
* Generated from protobuf field double scale = 3;
* @return float
*/
public function getScale()
{
return $this->scale;
}
/**
* Must be greater than 0.
*
* Generated from protobuf field double scale = 3;
* @param float $var
* @return $this
*/
public function setScale($var)
{
GPBUtil::checkDouble($var);
$this->scale = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Distribution/BucketOptions/Linear.php
================================================
google.api.Distribution.BucketOptions.Linear
*/
class Linear extends \Google\Protobuf\Internal\Message
{
/**
* Must be greater than 0.
*
* Generated from protobuf field int32 num_finite_buckets = 1;
*/
protected $num_finite_buckets = 0;
/**
* Must be greater than 0.
*
* Generated from protobuf field double width = 2;
*/
protected $width = 0.0;
/**
* Lower bound of the first bucket.
*
* Generated from protobuf field double offset = 3;
*/
protected $offset = 0.0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $num_finite_buckets
* Must be greater than 0.
* @type float $width
* Must be greater than 0.
* @type float $offset
* Lower bound of the first bucket.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Distribution::initOnce();
parent::__construct($data);
}
/**
* Must be greater than 0.
*
* Generated from protobuf field int32 num_finite_buckets = 1;
* @return int
*/
public function getNumFiniteBuckets()
{
return $this->num_finite_buckets;
}
/**
* Must be greater than 0.
*
* Generated from protobuf field int32 num_finite_buckets = 1;
* @param int $var
* @return $this
*/
public function setNumFiniteBuckets($var)
{
GPBUtil::checkInt32($var);
$this->num_finite_buckets = $var;
return $this;
}
/**
* Must be greater than 0.
*
* Generated from protobuf field double width = 2;
* @return float
*/
public function getWidth()
{
return $this->width;
}
/**
* Must be greater than 0.
*
* Generated from protobuf field double width = 2;
* @param float $var
* @return $this
*/
public function setWidth($var)
{
GPBUtil::checkDouble($var);
$this->width = $var;
return $this;
}
/**
* Lower bound of the first bucket.
*
* Generated from protobuf field double offset = 3;
* @return float
*/
public function getOffset()
{
return $this->offset;
}
/**
* Lower bound of the first bucket.
*
* Generated from protobuf field double offset = 3;
* @param float $var
* @return $this
*/
public function setOffset($var)
{
GPBUtil::checkDouble($var);
$this->offset = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Distribution/BucketOptions.php
================================================
0) is the
* same as the upper bound of bucket i - 1. The buckets span the whole range
* of finite values: lower bound of the underflow bucket is -infinity and the
* upper bound of the overflow bucket is +infinity. The finite buckets are
* so-called because both bounds are finite.
*
* Generated from protobuf message google.api.Distribution.BucketOptions
*/
class BucketOptions extends \Google\Protobuf\Internal\Message
{
protected $options;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Api\Distribution\BucketOptions\Linear $linear_buckets
* The linear bucket.
* @type \Google\Api\Distribution\BucketOptions\Exponential $exponential_buckets
* The exponential buckets.
* @type \Google\Api\Distribution\BucketOptions\Explicit $explicit_buckets
* The explicit buckets.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Distribution::initOnce();
parent::__construct($data);
}
/**
* The linear bucket.
*
* Generated from protobuf field .google.api.Distribution.BucketOptions.Linear linear_buckets = 1;
* @return \Google\Api\Distribution\BucketOptions\Linear|null
*/
public function getLinearBuckets()
{
return $this->readOneof(1);
}
public function hasLinearBuckets()
{
return $this->hasOneof(1);
}
/**
* The linear bucket.
*
* Generated from protobuf field .google.api.Distribution.BucketOptions.Linear linear_buckets = 1;
* @param \Google\Api\Distribution\BucketOptions\Linear $var
* @return $this
*/
public function setLinearBuckets($var)
{
GPBUtil::checkMessage($var, \Google\Api\Distribution\BucketOptions\Linear::class);
$this->writeOneof(1, $var);
return $this;
}
/**
* The exponential buckets.
*
* Generated from protobuf field .google.api.Distribution.BucketOptions.Exponential exponential_buckets = 2;
* @return \Google\Api\Distribution\BucketOptions\Exponential|null
*/
public function getExponentialBuckets()
{
return $this->readOneof(2);
}
public function hasExponentialBuckets()
{
return $this->hasOneof(2);
}
/**
* The exponential buckets.
*
* Generated from protobuf field .google.api.Distribution.BucketOptions.Exponential exponential_buckets = 2;
* @param \Google\Api\Distribution\BucketOptions\Exponential $var
* @return $this
*/
public function setExponentialBuckets($var)
{
GPBUtil::checkMessage($var, \Google\Api\Distribution\BucketOptions\Exponential::class);
$this->writeOneof(2, $var);
return $this;
}
/**
* The explicit buckets.
*
* Generated from protobuf field .google.api.Distribution.BucketOptions.Explicit explicit_buckets = 3;
* @return \Google\Api\Distribution\BucketOptions\Explicit|null
*/
public function getExplicitBuckets()
{
return $this->readOneof(3);
}
public function hasExplicitBuckets()
{
return $this->hasOneof(3);
}
/**
* The explicit buckets.
*
* Generated from protobuf field .google.api.Distribution.BucketOptions.Explicit explicit_buckets = 3;
* @param \Google\Api\Distribution\BucketOptions\Explicit $var
* @return $this
*/
public function setExplicitBuckets($var)
{
GPBUtil::checkMessage($var, \Google\Api\Distribution\BucketOptions\Explicit::class);
$this->writeOneof(3, $var);
return $this;
}
/**
* @return string
*/
public function getOptions()
{
return $this->whichOneof("options");
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Distribution/Exemplar.php
================================================
google.api.Distribution.Exemplar
*/
class Exemplar extends \Google\Protobuf\Internal\Message
{
/**
* Value of the exemplar point. This value determines to which bucket the
* exemplar belongs.
*
* Generated from protobuf field double value = 1;
*/
protected $value = 0.0;
/**
* The observation (sampling) time of the above value.
*
* Generated from protobuf field .google.protobuf.Timestamp timestamp = 2;
*/
protected $timestamp = null;
/**
* Contextual information about the example value. Examples are:
* Trace: type.googleapis.com/google.monitoring.v3.SpanContext
* Literal string: type.googleapis.com/google.protobuf.StringValue
* Labels dropped during aggregation:
* type.googleapis.com/google.monitoring.v3.DroppedLabels
* There may be only a single attachment of any given message type in a
* single exemplar, and this is enforced by the system.
*
* Generated from protobuf field repeated .google.protobuf.Any attachments = 3;
*/
private $attachments;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type float $value
* Value of the exemplar point. This value determines to which bucket the
* exemplar belongs.
* @type \Google\Protobuf\Timestamp $timestamp
* The observation (sampling) time of the above value.
* @type array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $attachments
* Contextual information about the example value. Examples are:
* Trace: type.googleapis.com/google.monitoring.v3.SpanContext
* Literal string: type.googleapis.com/google.protobuf.StringValue
* Labels dropped during aggregation:
* type.googleapis.com/google.monitoring.v3.DroppedLabels
* There may be only a single attachment of any given message type in a
* single exemplar, and this is enforced by the system.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Distribution::initOnce();
parent::__construct($data);
}
/**
* Value of the exemplar point. This value determines to which bucket the
* exemplar belongs.
*
* Generated from protobuf field double value = 1;
* @return float
*/
public function getValue()
{
return $this->value;
}
/**
* Value of the exemplar point. This value determines to which bucket the
* exemplar belongs.
*
* Generated from protobuf field double value = 1;
* @param float $var
* @return $this
*/
public function setValue($var)
{
GPBUtil::checkDouble($var);
$this->value = $var;
return $this;
}
/**
* The observation (sampling) time of the above value.
*
* Generated from protobuf field .google.protobuf.Timestamp timestamp = 2;
* @return \Google\Protobuf\Timestamp|null
*/
public function getTimestamp()
{
return $this->timestamp;
}
public function hasTimestamp()
{
return isset($this->timestamp);
}
public function clearTimestamp()
{
unset($this->timestamp);
}
/**
* The observation (sampling) time of the above value.
*
* Generated from protobuf field .google.protobuf.Timestamp timestamp = 2;
* @param \Google\Protobuf\Timestamp $var
* @return $this
*/
public function setTimestamp($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
$this->timestamp = $var;
return $this;
}
/**
* Contextual information about the example value. Examples are:
* Trace: type.googleapis.com/google.monitoring.v3.SpanContext
* Literal string: type.googleapis.com/google.protobuf.StringValue
* Labels dropped during aggregation:
* type.googleapis.com/google.monitoring.v3.DroppedLabels
* There may be only a single attachment of any given message type in a
* single exemplar, and this is enforced by the system.
*
* Generated from protobuf field repeated .google.protobuf.Any attachments = 3;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getAttachments()
{
return $this->attachments;
}
/**
* Contextual information about the example value. Examples are:
* Trace: type.googleapis.com/google.monitoring.v3.SpanContext
* Literal string: type.googleapis.com/google.protobuf.StringValue
* Labels dropped during aggregation:
* type.googleapis.com/google.monitoring.v3.DroppedLabels
* There may be only a single attachment of any given message type in a
* single exemplar, and this is enforced by the system.
*
* Generated from protobuf field repeated .google.protobuf.Any attachments = 3;
* @param array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setAttachments($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class);
$this->attachments = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Distribution/Range.php
================================================
google.api.Distribution.Range
*/
class Range extends \Google\Protobuf\Internal\Message
{
/**
* The minimum of the population values.
*
* Generated from protobuf field double min = 1;
*/
protected $min = 0.0;
/**
* The maximum of the population values.
*
* Generated from protobuf field double max = 2;
*/
protected $max = 0.0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type float $min
* The minimum of the population values.
* @type float $max
* The maximum of the population values.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Distribution::initOnce();
parent::__construct($data);
}
/**
* The minimum of the population values.
*
* Generated from protobuf field double min = 1;
* @return float
*/
public function getMin()
{
return $this->min;
}
/**
* The minimum of the population values.
*
* Generated from protobuf field double min = 1;
* @param float $var
* @return $this
*/
public function setMin($var)
{
GPBUtil::checkDouble($var);
$this->min = $var;
return $this;
}
/**
* The maximum of the population values.
*
* Generated from protobuf field double max = 2;
* @return float
*/
public function getMax()
{
return $this->max;
}
/**
* The maximum of the population values.
*
* Generated from protobuf field double max = 2;
* @param float $var
* @return $this
*/
public function setMax($var)
{
GPBUtil::checkDouble($var);
$this->max = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Distribution.php
================================================
google.api.Distribution
*/
class Distribution extends \Google\Protobuf\Internal\Message
{
/**
* The number of values in the population. Must be non-negative. This value
* must equal the sum of the values in `bucket_counts` if a histogram is
* provided.
*
* Generated from protobuf field int64 count = 1;
*/
protected $count = 0;
/**
* The arithmetic mean of the values in the population. If `count` is zero
* then this field must be zero.
*
* Generated from protobuf field double mean = 2;
*/
protected $mean = 0.0;
/**
* The sum of squared deviations from the mean of the values in the
* population. For values x_i this is:
* Sum[i=1..n]((x_i - mean)^2)
* Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
* describes Welford's method for accumulating this sum in one pass.
* If `count` is zero then this field must be zero.
*
* Generated from protobuf field double sum_of_squared_deviation = 3;
*/
protected $sum_of_squared_deviation = 0.0;
/**
* If specified, contains the range of the population values. The field
* must not be present if the `count` is zero.
*
* Generated from protobuf field .google.api.Distribution.Range range = 4;
*/
protected $range = null;
/**
* Defines the histogram bucket boundaries. If the distribution does not
* contain a histogram, then omit this field.
*
* Generated from protobuf field .google.api.Distribution.BucketOptions bucket_options = 6;
*/
protected $bucket_options = null;
/**
* The number of values in each bucket of the histogram, as described in
* `bucket_options`. If the distribution does not have a histogram, then omit
* this field. If there is a histogram, then the sum of the values in
* `bucket_counts` must equal the value in the `count` field of the
* distribution.
* If present, `bucket_counts` should contain N values, where N is the number
* of buckets specified in `bucket_options`. If you supply fewer than N
* values, the remaining values are assumed to be 0.
* The order of the values in `bucket_counts` follows the bucket numbering
* schemes described for the three bucket types. The first value must be the
* count for the underflow bucket (number 0). The next N-2 values are the
* counts for the finite buckets (number 1 through N-2). The N'th value in
* `bucket_counts` is the count for the overflow bucket (number N-1).
*
* Generated from protobuf field repeated int64 bucket_counts = 7;
*/
private $bucket_counts;
/**
* Must be in increasing order of `value` field.
*
* Generated from protobuf field repeated .google.api.Distribution.Exemplar exemplars = 10;
*/
private $exemplars;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int|string $count
* The number of values in the population. Must be non-negative. This value
* must equal the sum of the values in `bucket_counts` if a histogram is
* provided.
* @type float $mean
* The arithmetic mean of the values in the population. If `count` is zero
* then this field must be zero.
* @type float $sum_of_squared_deviation
* The sum of squared deviations from the mean of the values in the
* population. For values x_i this is:
* Sum[i=1..n]((x_i - mean)^2)
* Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
* describes Welford's method for accumulating this sum in one pass.
* If `count` is zero then this field must be zero.
* @type \Google\Api\Distribution\Range $range
* If specified, contains the range of the population values. The field
* must not be present if the `count` is zero.
* @type \Google\Api\Distribution\BucketOptions $bucket_options
* Defines the histogram bucket boundaries. If the distribution does not
* contain a histogram, then omit this field.
* @type array|array|\Google\Protobuf\Internal\RepeatedField $bucket_counts
* The number of values in each bucket of the histogram, as described in
* `bucket_options`. If the distribution does not have a histogram, then omit
* this field. If there is a histogram, then the sum of the values in
* `bucket_counts` must equal the value in the `count` field of the
* distribution.
* If present, `bucket_counts` should contain N values, where N is the number
* of buckets specified in `bucket_options`. If you supply fewer than N
* values, the remaining values are assumed to be 0.
* The order of the values in `bucket_counts` follows the bucket numbering
* schemes described for the three bucket types. The first value must be the
* count for the underflow bucket (number 0). The next N-2 values are the
* counts for the finite buckets (number 1 through N-2). The N'th value in
* `bucket_counts` is the count for the overflow bucket (number N-1).
* @type array<\Google\Api\Distribution\Exemplar>|\Google\Protobuf\Internal\RepeatedField $exemplars
* Must be in increasing order of `value` field.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Distribution::initOnce();
parent::__construct($data);
}
/**
* The number of values in the population. Must be non-negative. This value
* must equal the sum of the values in `bucket_counts` if a histogram is
* provided.
*
* Generated from protobuf field int64 count = 1;
* @return int|string
*/
public function getCount()
{
return $this->count;
}
/**
* The number of values in the population. Must be non-negative. This value
* must equal the sum of the values in `bucket_counts` if a histogram is
* provided.
*
* Generated from protobuf field int64 count = 1;
* @param int|string $var
* @return $this
*/
public function setCount($var)
{
GPBUtil::checkInt64($var);
$this->count = $var;
return $this;
}
/**
* The arithmetic mean of the values in the population. If `count` is zero
* then this field must be zero.
*
* Generated from protobuf field double mean = 2;
* @return float
*/
public function getMean()
{
return $this->mean;
}
/**
* The arithmetic mean of the values in the population. If `count` is zero
* then this field must be zero.
*
* Generated from protobuf field double mean = 2;
* @param float $var
* @return $this
*/
public function setMean($var)
{
GPBUtil::checkDouble($var);
$this->mean = $var;
return $this;
}
/**
* The sum of squared deviations from the mean of the values in the
* population. For values x_i this is:
* Sum[i=1..n]((x_i - mean)^2)
* Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
* describes Welford's method for accumulating this sum in one pass.
* If `count` is zero then this field must be zero.
*
* Generated from protobuf field double sum_of_squared_deviation = 3;
* @return float
*/
public function getSumOfSquaredDeviation()
{
return $this->sum_of_squared_deviation;
}
/**
* The sum of squared deviations from the mean of the values in the
* population. For values x_i this is:
* Sum[i=1..n]((x_i - mean)^2)
* Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
* describes Welford's method for accumulating this sum in one pass.
* If `count` is zero then this field must be zero.
*
* Generated from protobuf field double sum_of_squared_deviation = 3;
* @param float $var
* @return $this
*/
public function setSumOfSquaredDeviation($var)
{
GPBUtil::checkDouble($var);
$this->sum_of_squared_deviation = $var;
return $this;
}
/**
* If specified, contains the range of the population values. The field
* must not be present if the `count` is zero.
*
* Generated from protobuf field .google.api.Distribution.Range range = 4;
* @return \Google\Api\Distribution\Range|null
*/
public function getRange()
{
return $this->range;
}
public function hasRange()
{
return isset($this->range);
}
public function clearRange()
{
unset($this->range);
}
/**
* If specified, contains the range of the population values. The field
* must not be present if the `count` is zero.
*
* Generated from protobuf field .google.api.Distribution.Range range = 4;
* @param \Google\Api\Distribution\Range $var
* @return $this
*/
public function setRange($var)
{
GPBUtil::checkMessage($var, \Google\Api\Distribution\Range::class);
$this->range = $var;
return $this;
}
/**
* Defines the histogram bucket boundaries. If the distribution does not
* contain a histogram, then omit this field.
*
* Generated from protobuf field .google.api.Distribution.BucketOptions bucket_options = 6;
* @return \Google\Api\Distribution\BucketOptions|null
*/
public function getBucketOptions()
{
return $this->bucket_options;
}
public function hasBucketOptions()
{
return isset($this->bucket_options);
}
public function clearBucketOptions()
{
unset($this->bucket_options);
}
/**
* Defines the histogram bucket boundaries. If the distribution does not
* contain a histogram, then omit this field.
*
* Generated from protobuf field .google.api.Distribution.BucketOptions bucket_options = 6;
* @param \Google\Api\Distribution\BucketOptions $var
* @return $this
*/
public function setBucketOptions($var)
{
GPBUtil::checkMessage($var, \Google\Api\Distribution\BucketOptions::class);
$this->bucket_options = $var;
return $this;
}
/**
* The number of values in each bucket of the histogram, as described in
* `bucket_options`. If the distribution does not have a histogram, then omit
* this field. If there is a histogram, then the sum of the values in
* `bucket_counts` must equal the value in the `count` field of the
* distribution.
* If present, `bucket_counts` should contain N values, where N is the number
* of buckets specified in `bucket_options`. If you supply fewer than N
* values, the remaining values are assumed to be 0.
* The order of the values in `bucket_counts` follows the bucket numbering
* schemes described for the three bucket types. The first value must be the
* count for the underflow bucket (number 0). The next N-2 values are the
* counts for the finite buckets (number 1 through N-2). The N'th value in
* `bucket_counts` is the count for the overflow bucket (number N-1).
*
* Generated from protobuf field repeated int64 bucket_counts = 7;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getBucketCounts()
{
return $this->bucket_counts;
}
/**
* The number of values in each bucket of the histogram, as described in
* `bucket_options`. If the distribution does not have a histogram, then omit
* this field. If there is a histogram, then the sum of the values in
* `bucket_counts` must equal the value in the `count` field of the
* distribution.
* If present, `bucket_counts` should contain N values, where N is the number
* of buckets specified in `bucket_options`. If you supply fewer than N
* values, the remaining values are assumed to be 0.
* The order of the values in `bucket_counts` follows the bucket numbering
* schemes described for the three bucket types. The first value must be the
* count for the underflow bucket (number 0). The next N-2 values are the
* counts for the finite buckets (number 1 through N-2). The N'th value in
* `bucket_counts` is the count for the overflow bucket (number N-1).
*
* Generated from protobuf field repeated int64 bucket_counts = 7;
* @param array|array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setBucketCounts($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT64);
$this->bucket_counts = $arr;
return $this;
}
/**
* Must be in increasing order of `value` field.
*
* Generated from protobuf field repeated .google.api.Distribution.Exemplar exemplars = 10;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getExemplars()
{
return $this->exemplars;
}
/**
* Must be in increasing order of `value` field.
*
* Generated from protobuf field repeated .google.api.Distribution.Exemplar exemplars = 10;
* @param array<\Google\Api\Distribution\Exemplar>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setExemplars($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Distribution\Exemplar::class);
$this->exemplars = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Documentation.php
================================================
documentation:
* summary: >
* The Google Calendar API gives access
* to most calendar features.
* pages:
* - name: Overview
* content: (== include google/foo/overview.md ==)
* - name: Tutorial
* content: (== include google/foo/tutorial.md ==)
* subpages:
* - name: Java
* content: (== include google/foo/tutorial_java.md ==)
* rules:
* - selector: google.calendar.Calendar.Get
* description: >
* ...
* - selector: google.calendar.Calendar.Put
* description: >
* ...
*
* Documentation is provided in markdown syntax. In addition to
* standard markdown features, definition lists, tables and fenced
* code blocks are supported. Section headers can be provided and are
* interpreted relative to the section nesting of the context where
* a documentation fragment is embedded.
* Documentation from the IDL is merged with documentation defined
* via the config at normalization time, where documentation provided
* by config rules overrides IDL provided.
* A number of constructs specific to the API platform are supported
* in documentation text.
* In order to reference a proto element, the following
* notation can be used:
* [fully.qualified.proto.name][]
* To override the display text used for the link, this can be used:
* [display text][fully.qualified.proto.name]
* Text can be excluded from doc using the following notation:
* (-- internal comment --)
* A few directives are available in documentation. Note that
* directives must appear on a single line to be properly
* identified. The `include` directive includes a markdown file from
* an external source:
* (== include path/to/file ==)
* The `resource_for` directive marks a message to be the resource of
* a collection in REST view. If it is not specified, tools attempt
* to infer the resource from the operations in a collection:
* (== resource_for v1.shelves.books ==)
* The directive `suppress_warning` does not directly affect documentation
* and is documented together with service config validation.
*
* Generated from protobuf message google.api.Documentation
*/
class Documentation extends \Google\Protobuf\Internal\Message
{
/**
* A short description of what the service does. The summary must be plain
* text. It becomes the overview of the service displayed in Google Cloud
* Console.
* NOTE: This field is equivalent to the standard field `description`.
*
* Generated from protobuf field string summary = 1;
*/
protected $summary = '';
/**
* The top level pages for the documentation set.
*
* Generated from protobuf field repeated .google.api.Page pages = 5;
*/
private $pages;
/**
* A list of documentation rules that apply to individual API elements.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.DocumentationRule rules = 3;
*/
private $rules;
/**
* The URL to the root of documentation.
*
* Generated from protobuf field string documentation_root_url = 4;
*/
protected $documentation_root_url = '';
/**
* Specifies the service root url if the default one (the service name
* from the yaml file) is not suitable. This can be seen in any fully
* specified service urls as well as sections that show a base that other
* urls are relative to.
*
* Generated from protobuf field string service_root_url = 6;
*/
protected $service_root_url = '';
/**
* Declares a single overview page. For example:
* documentation:
* summary: ...
* overview: (== include overview.md ==)
*
* This is a shortcut for the following declaration (using pages style):
* documentation:
* summary: ...
* pages:
* - name: Overview
* content: (== include overview.md ==)
*
* Note: you cannot specify both `overview` field and `pages` field.
*
* Generated from protobuf field string overview = 2;
*/
protected $overview = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $summary
* A short description of what the service does. The summary must be plain
* text. It becomes the overview of the service displayed in Google Cloud
* Console.
* NOTE: This field is equivalent to the standard field `description`.
* @type array<\Google\Api\Page>|\Google\Protobuf\Internal\RepeatedField $pages
* The top level pages for the documentation set.
* @type array<\Google\Api\DocumentationRule>|\Google\Protobuf\Internal\RepeatedField $rules
* A list of documentation rules that apply to individual API elements.
* **NOTE:** All service configuration rules follow "last one wins" order.
* @type string $documentation_root_url
* The URL to the root of documentation.
* @type string $service_root_url
* Specifies the service root url if the default one (the service name
* from the yaml file) is not suitable. This can be seen in any fully
* specified service urls as well as sections that show a base that other
* urls are relative to.
* @type string $overview
* Declares a single overview page. For example:
* documentation:
* summary: ...
* overview: (== include overview.md ==)
*
* This is a shortcut for the following declaration (using pages style):
* documentation:
* summary: ...
* pages:
* - name: Overview
* content: (== include overview.md ==)
*
* Note: you cannot specify both `overview` field and `pages` field.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Documentation::initOnce();
parent::__construct($data);
}
/**
* A short description of what the service does. The summary must be plain
* text. It becomes the overview of the service displayed in Google Cloud
* Console.
* NOTE: This field is equivalent to the standard field `description`.
*
* Generated from protobuf field string summary = 1;
* @return string
*/
public function getSummary()
{
return $this->summary;
}
/**
* A short description of what the service does. The summary must be plain
* text. It becomes the overview of the service displayed in Google Cloud
* Console.
* NOTE: This field is equivalent to the standard field `description`.
*
* Generated from protobuf field string summary = 1;
* @param string $var
* @return $this
*/
public function setSummary($var)
{
GPBUtil::checkString($var, True);
$this->summary = $var;
return $this;
}
/**
* The top level pages for the documentation set.
*
* Generated from protobuf field repeated .google.api.Page pages = 5;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getPages()
{
return $this->pages;
}
/**
* The top level pages for the documentation set.
*
* Generated from protobuf field repeated .google.api.Page pages = 5;
* @param array<\Google\Api\Page>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setPages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Page::class);
$this->pages = $arr;
return $this;
}
/**
* A list of documentation rules that apply to individual API elements.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.DocumentationRule rules = 3;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getRules()
{
return $this->rules;
}
/**
* A list of documentation rules that apply to individual API elements.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.DocumentationRule rules = 3;
* @param array<\Google\Api\DocumentationRule>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setRules($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\DocumentationRule::class);
$this->rules = $arr;
return $this;
}
/**
* The URL to the root of documentation.
*
* Generated from protobuf field string documentation_root_url = 4;
* @return string
*/
public function getDocumentationRootUrl()
{
return $this->documentation_root_url;
}
/**
* The URL to the root of documentation.
*
* Generated from protobuf field string documentation_root_url = 4;
* @param string $var
* @return $this
*/
public function setDocumentationRootUrl($var)
{
GPBUtil::checkString($var, True);
$this->documentation_root_url = $var;
return $this;
}
/**
* Specifies the service root url if the default one (the service name
* from the yaml file) is not suitable. This can be seen in any fully
* specified service urls as well as sections that show a base that other
* urls are relative to.
*
* Generated from protobuf field string service_root_url = 6;
* @return string
*/
public function getServiceRootUrl()
{
return $this->service_root_url;
}
/**
* Specifies the service root url if the default one (the service name
* from the yaml file) is not suitable. This can be seen in any fully
* specified service urls as well as sections that show a base that other
* urls are relative to.
*
* Generated from protobuf field string service_root_url = 6;
* @param string $var
* @return $this
*/
public function setServiceRootUrl($var)
{
GPBUtil::checkString($var, True);
$this->service_root_url = $var;
return $this;
}
/**
* Declares a single overview page. For example:
* documentation:
* summary: ...
* overview: (== include overview.md ==)
*
* This is a shortcut for the following declaration (using pages style):
* documentation:
* summary: ...
* pages:
* - name: Overview
* content: (== include overview.md ==)
*
* Note: you cannot specify both `overview` field and `pages` field.
*
* Generated from protobuf field string overview = 2;
* @return string
*/
public function getOverview()
{
return $this->overview;
}
/**
* Declares a single overview page. For example:
* documentation:
* summary: ...
* overview: (== include overview.md ==)
*
* This is a shortcut for the following declaration (using pages style):
* documentation:
* summary: ...
* pages:
* - name: Overview
* content: (== include overview.md ==)
*
* Note: you cannot specify both `overview` field and `pages` field.
*
* Generated from protobuf field string overview = 2;
* @param string $var
* @return $this
*/
public function setOverview($var)
{
GPBUtil::checkString($var, True);
$this->overview = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/DocumentationRule.php
================================================
google.api.DocumentationRule
*/
class DocumentationRule extends \Google\Protobuf\Internal\Message
{
/**
* The selector is a comma-separated list of patterns for any element such as
* a method, a field, an enum value. Each pattern is a qualified name of the
* element which may end in "*", indicating a wildcard. Wildcards are only
* allowed at the end and for a whole component of the qualified name,
* i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
* one or more components. To specify a default for all applicable elements,
* the whole pattern "*" is used.
*
* Generated from protobuf field string selector = 1;
*/
protected $selector = '';
/**
* Description of the selected proto element (e.g. a message, a method, a
* 'service' definition, or a field). Defaults to leading & trailing comments
* taken from the proto source definition of the proto element.
*
* Generated from protobuf field string description = 2;
*/
protected $description = '';
/**
* Deprecation description of the selected element(s). It can be provided if
* an element is marked as `deprecated`.
*
* Generated from protobuf field string deprecation_description = 3;
*/
protected $deprecation_description = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $selector
* The selector is a comma-separated list of patterns for any element such as
* a method, a field, an enum value. Each pattern is a qualified name of the
* element which may end in "*", indicating a wildcard. Wildcards are only
* allowed at the end and for a whole component of the qualified name,
* i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
* one or more components. To specify a default for all applicable elements,
* the whole pattern "*" is used.
* @type string $description
* Description of the selected proto element (e.g. a message, a method, a
* 'service' definition, or a field). Defaults to leading & trailing comments
* taken from the proto source definition of the proto element.
* @type string $deprecation_description
* Deprecation description of the selected element(s). It can be provided if
* an element is marked as `deprecated`.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Documentation::initOnce();
parent::__construct($data);
}
/**
* The selector is a comma-separated list of patterns for any element such as
* a method, a field, an enum value. Each pattern is a qualified name of the
* element which may end in "*", indicating a wildcard. Wildcards are only
* allowed at the end and for a whole component of the qualified name,
* i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
* one or more components. To specify a default for all applicable elements,
* the whole pattern "*" is used.
*
* Generated from protobuf field string selector = 1;
* @return string
*/
public function getSelector()
{
return $this->selector;
}
/**
* The selector is a comma-separated list of patterns for any element such as
* a method, a field, an enum value. Each pattern is a qualified name of the
* element which may end in "*", indicating a wildcard. Wildcards are only
* allowed at the end and for a whole component of the qualified name,
* i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
* one or more components. To specify a default for all applicable elements,
* the whole pattern "*" is used.
*
* Generated from protobuf field string selector = 1;
* @param string $var
* @return $this
*/
public function setSelector($var)
{
GPBUtil::checkString($var, True);
$this->selector = $var;
return $this;
}
/**
* Description of the selected proto element (e.g. a message, a method, a
* 'service' definition, or a field). Defaults to leading & trailing comments
* taken from the proto source definition of the proto element.
*
* Generated from protobuf field string description = 2;
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Description of the selected proto element (e.g. a message, a method, a
* 'service' definition, or a field). Defaults to leading & trailing comments
* taken from the proto source definition of the proto element.
*
* Generated from protobuf field string description = 2;
* @param string $var
* @return $this
*/
public function setDescription($var)
{
GPBUtil::checkString($var, True);
$this->description = $var;
return $this;
}
/**
* Deprecation description of the selected element(s). It can be provided if
* an element is marked as `deprecated`.
*
* Generated from protobuf field string deprecation_description = 3;
* @return string
*/
public function getDeprecationDescription()
{
return $this->deprecation_description;
}
/**
* Deprecation description of the selected element(s). It can be provided if
* an element is marked as `deprecated`.
*
* Generated from protobuf field string deprecation_description = 3;
* @param string $var
* @return $this
*/
public function setDeprecationDescription($var)
{
GPBUtil::checkString($var, True);
$this->deprecation_description = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/DotnetSettings.php
================================================
google.api.DotnetSettings
*/
class DotnetSettings extends \Google\Protobuf\Internal\Message
{
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
*/
protected $common = null;
/**
* Map from original service names to renamed versions.
* This is used when the default generated types
* would cause a naming conflict. (Neither name is
* fully-qualified.)
* Example: Subscriber to SubscriberServiceApi.
*
* Generated from protobuf field map renamed_services = 2;
*/
private $renamed_services;
/**
* Map from full resource types to the effective short name
* for the resource. This is used when otherwise resource
* named from different services would cause naming collisions.
* Example entry:
* "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
*
* Generated from protobuf field map renamed_resources = 3;
*/
private $renamed_resources;
/**
* List of full resource types to ignore during generation.
* This is typically used for API-specific Location resources,
* which should be handled by the generator as if they were actually
* the common Location resources.
* Example entry: "documentai.googleapis.com/Location"
*
* Generated from protobuf field repeated string ignored_resources = 4;
*/
private $ignored_resources;
/**
* Namespaces which must be aliased in snippets due to
* a known (but non-generator-predictable) naming collision
*
* Generated from protobuf field repeated string forced_namespace_aliases = 5;
*/
private $forced_namespace_aliases;
/**
* Method signatures (in the form "service.method(signature)")
* which are provided separately, so shouldn't be generated.
* Snippets *calling* these methods are still generated, however.
*
* Generated from protobuf field repeated string handwritten_signatures = 6;
*/
private $handwritten_signatures;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Api\CommonLanguageSettings $common
* Some settings.
* @type array|\Google\Protobuf\Internal\MapField $renamed_services
* Map from original service names to renamed versions.
* This is used when the default generated types
* would cause a naming conflict. (Neither name is
* fully-qualified.)
* Example: Subscriber to SubscriberServiceApi.
* @type array|\Google\Protobuf\Internal\MapField $renamed_resources
* Map from full resource types to the effective short name
* for the resource. This is used when otherwise resource
* named from different services would cause naming collisions.
* Example entry:
* "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
* @type array|\Google\Protobuf\Internal\RepeatedField $ignored_resources
* List of full resource types to ignore during generation.
* This is typically used for API-specific Location resources,
* which should be handled by the generator as if they were actually
* the common Location resources.
* Example entry: "documentai.googleapis.com/Location"
* @type array|\Google\Protobuf\Internal\RepeatedField $forced_namespace_aliases
* Namespaces which must be aliased in snippets due to
* a known (but non-generator-predictable) naming collision
* @type array|\Google\Protobuf\Internal\RepeatedField $handwritten_signatures
* Method signatures (in the form "service.method(signature)")
* which are provided separately, so shouldn't be generated.
* Snippets *calling* these methods are still generated, however.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @return \Google\Api\CommonLanguageSettings|null
*/
public function getCommon()
{
return $this->common;
}
public function hasCommon()
{
return isset($this->common);
}
public function clearCommon()
{
unset($this->common);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @param \Google\Api\CommonLanguageSettings $var
* @return $this
*/
public function setCommon($var)
{
GPBUtil::checkMessage($var, \Google\Api\CommonLanguageSettings::class);
$this->common = $var;
return $this;
}
/**
* Map from original service names to renamed versions.
* This is used when the default generated types
* would cause a naming conflict. (Neither name is
* fully-qualified.)
* Example: Subscriber to SubscriberServiceApi.
*
* Generated from protobuf field map renamed_services = 2;
* @return \Google\Protobuf\Internal\MapField
*/
public function getRenamedServices()
{
return $this->renamed_services;
}
/**
* Map from original service names to renamed versions.
* This is used when the default generated types
* would cause a naming conflict. (Neither name is
* fully-qualified.)
* Example: Subscriber to SubscriberServiceApi.
*
* Generated from protobuf field map renamed_services = 2;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setRenamedServices($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->renamed_services = $arr;
return $this;
}
/**
* Map from full resource types to the effective short name
* for the resource. This is used when otherwise resource
* named from different services would cause naming collisions.
* Example entry:
* "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
*
* Generated from protobuf field map renamed_resources = 3;
* @return \Google\Protobuf\Internal\MapField
*/
public function getRenamedResources()
{
return $this->renamed_resources;
}
/**
* Map from full resource types to the effective short name
* for the resource. This is used when otherwise resource
* named from different services would cause naming collisions.
* Example entry:
* "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
*
* Generated from protobuf field map renamed_resources = 3;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setRenamedResources($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->renamed_resources = $arr;
return $this;
}
/**
* List of full resource types to ignore during generation.
* This is typically used for API-specific Location resources,
* which should be handled by the generator as if they were actually
* the common Location resources.
* Example entry: "documentai.googleapis.com/Location"
*
* Generated from protobuf field repeated string ignored_resources = 4;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getIgnoredResources()
{
return $this->ignored_resources;
}
/**
* List of full resource types to ignore during generation.
* This is typically used for API-specific Location resources,
* which should be handled by the generator as if they were actually
* the common Location resources.
* Example entry: "documentai.googleapis.com/Location"
*
* Generated from protobuf field repeated string ignored_resources = 4;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setIgnoredResources($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->ignored_resources = $arr;
return $this;
}
/**
* Namespaces which must be aliased in snippets due to
* a known (but non-generator-predictable) naming collision
*
* Generated from protobuf field repeated string forced_namespace_aliases = 5;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getForcedNamespaceAliases()
{
return $this->forced_namespace_aliases;
}
/**
* Namespaces which must be aliased in snippets due to
* a known (but non-generator-predictable) naming collision
*
* Generated from protobuf field repeated string forced_namespace_aliases = 5;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setForcedNamespaceAliases($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->forced_namespace_aliases = $arr;
return $this;
}
/**
* Method signatures (in the form "service.method(signature)")
* which are provided separately, so shouldn't be generated.
* Snippets *calling* these methods are still generated, however.
*
* Generated from protobuf field repeated string handwritten_signatures = 6;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getHandwrittenSignatures()
{
return $this->handwritten_signatures;
}
/**
* Method signatures (in the form "service.method(signature)")
* which are provided separately, so shouldn't be generated.
* Snippets *calling* these methods are still generated, however.
*
* Generated from protobuf field repeated string handwritten_signatures = 6;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setHandwrittenSignatures($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->handwritten_signatures = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Endpoint.php
================================================
google.api.Endpoint
*/
class Endpoint extends \Google\Protobuf\Internal\Message
{
/**
* The canonical name of this endpoint.
*
* Generated from protobuf field string name = 1;
*/
protected $name = '';
/**
* Aliases for this endpoint, these will be served by the same UrlMap as the
* parent endpoint, and will be provisioned in the GCP stack for the Regional
* Endpoints.
*
* Generated from protobuf field repeated string aliases = 2;
*/
private $aliases;
/**
* The specification of an Internet routable address of API frontend that will
* handle requests to this [API
* Endpoint](https://cloud.google.com/apis/design/glossary). It should be
* either a valid IPv4 address or a fully-qualified domain name. For example,
* "8.8.8.8" or "myservice.appspot.com".
*
* Generated from protobuf field string target = 101;
*/
protected $target = '';
/**
* Allowing
* [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
* cross-domain traffic, would allow the backends served from this endpoint to
* receive and respond to HTTP OPTIONS requests. The response will be used by
* the browser to determine whether the subsequent cross-origin request is
* allowed to proceed.
*
* Generated from protobuf field bool allow_cors = 5;
*/
protected $allow_cors = false;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* The canonical name of this endpoint.
* @type array|\Google\Protobuf\Internal\RepeatedField $aliases
* Aliases for this endpoint, these will be served by the same UrlMap as the
* parent endpoint, and will be provisioned in the GCP stack for the Regional
* Endpoints.
* @type string $target
* The specification of an Internet routable address of API frontend that will
* handle requests to this [API
* Endpoint](https://cloud.google.com/apis/design/glossary). It should be
* either a valid IPv4 address or a fully-qualified domain name. For example,
* "8.8.8.8" or "myservice.appspot.com".
* @type bool $allow_cors
* Allowing
* [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
* cross-domain traffic, would allow the backends served from this endpoint to
* receive and respond to HTTP OPTIONS requests. The response will be used by
* the browser to determine whether the subsequent cross-origin request is
* allowed to proceed.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Endpoint::initOnce();
parent::__construct($data);
}
/**
* The canonical name of this endpoint.
*
* Generated from protobuf field string name = 1;
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The canonical name of this endpoint.
*
* Generated from protobuf field string name = 1;
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* Aliases for this endpoint, these will be served by the same UrlMap as the
* parent endpoint, and will be provisioned in the GCP stack for the Regional
* Endpoints.
*
* Generated from protobuf field repeated string aliases = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getAliases()
{
return $this->aliases;
}
/**
* Aliases for this endpoint, these will be served by the same UrlMap as the
* parent endpoint, and will be provisioned in the GCP stack for the Regional
* Endpoints.
*
* Generated from protobuf field repeated string aliases = 2;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setAliases($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->aliases = $arr;
return $this;
}
/**
* The specification of an Internet routable address of API frontend that will
* handle requests to this [API
* Endpoint](https://cloud.google.com/apis/design/glossary). It should be
* either a valid IPv4 address or a fully-qualified domain name. For example,
* "8.8.8.8" or "myservice.appspot.com".
*
* Generated from protobuf field string target = 101;
* @return string
*/
public function getTarget()
{
return $this->target;
}
/**
* The specification of an Internet routable address of API frontend that will
* handle requests to this [API
* Endpoint](https://cloud.google.com/apis/design/glossary). It should be
* either a valid IPv4 address or a fully-qualified domain name. For example,
* "8.8.8.8" or "myservice.appspot.com".
*
* Generated from protobuf field string target = 101;
* @param string $var
* @return $this
*/
public function setTarget($var)
{
GPBUtil::checkString($var, True);
$this->target = $var;
return $this;
}
/**
* Allowing
* [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
* cross-domain traffic, would allow the backends served from this endpoint to
* receive and respond to HTTP OPTIONS requests. The response will be used by
* the browser to determine whether the subsequent cross-origin request is
* allowed to proceed.
*
* Generated from protobuf field bool allow_cors = 5;
* @return bool
*/
public function getAllowCors()
{
return $this->allow_cors;
}
/**
* Allowing
* [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
* cross-domain traffic, would allow the backends served from this endpoint to
* receive and respond to HTTP OPTIONS requests. The response will be used by
* the browser to determine whether the subsequent cross-origin request is
* allowed to proceed.
*
* Generated from protobuf field bool allow_cors = 5;
* @param bool $var
* @return $this
*/
public function setAllowCors($var)
{
GPBUtil::checkBool($var);
$this->allow_cors = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ErrorReason.php
================================================
google.api.ErrorReason
*/
class ErrorReason
{
/**
* Do not use this default value.
*
* Generated from protobuf enum ERROR_REASON_UNSPECIFIED = 0;
*/
const ERROR_REASON_UNSPECIFIED = 0;
/**
* The request is calling a disabled service for a consumer.
* Example of an ErrorInfo when the consumer "projects/123" contacting
* "pubsub.googleapis.com" service which is disabled:
* { "reason": "SERVICE_DISABLED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "pubsub.googleapis.com"
* }
* }
* This response indicates the "pubsub.googleapis.com" has been disabled in
* "projects/123".
*
* Generated from protobuf enum SERVICE_DISABLED = 1;
*/
const SERVICE_DISABLED = 1;
/**
* The request whose associated billing account is disabled.
* Example of an ErrorInfo when the consumer "projects/123" fails to contact
* "pubsub.googleapis.com" service because the associated billing account is
* disabled:
* { "reason": "BILLING_DISABLED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "pubsub.googleapis.com"
* }
* }
* This response indicates the billing account associated has been disabled.
*
* Generated from protobuf enum BILLING_DISABLED = 2;
*/
const BILLING_DISABLED = 2;
/**
* The request is denied because the provided [API
* key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
* may be in a bad format, cannot be found, or has been expired).
* Example of an ErrorInfo when the request is contacting
* "storage.googleapis.com" service with an invalid API key:
* { "reason": "API_KEY_INVALID",
* "domain": "googleapis.com",
* "metadata": {
* "service": "storage.googleapis.com",
* }
* }
*
* Generated from protobuf enum API_KEY_INVALID = 3;
*/
const API_KEY_INVALID = 3;
/**
* The request is denied because it violates [API key API
* restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
* Example of an ErrorInfo when the consumer "projects/123" fails to call the
* "storage.googleapis.com" service because this service is restricted in the
* API key:
* { "reason": "API_KEY_SERVICE_BLOCKED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "storage.googleapis.com"
* }
* }
*
* Generated from protobuf enum API_KEY_SERVICE_BLOCKED = 4;
*/
const API_KEY_SERVICE_BLOCKED = 4;
/**
* The request is denied because it violates [API key HTTP
* restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
* Example of an ErrorInfo when the consumer "projects/123" fails to call
* "storage.googleapis.com" service because the http referrer of the request
* violates API key HTTP restrictions:
* { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "storage.googleapis.com",
* }
* }
*
* Generated from protobuf enum API_KEY_HTTP_REFERRER_BLOCKED = 7;
*/
const API_KEY_HTTP_REFERRER_BLOCKED = 7;
/**
* The request is denied because it violates [API key IP address
* restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
* Example of an ErrorInfo when the consumer "projects/123" fails to call
* "storage.googleapis.com" service because the caller IP of the request
* violates API key IP address restrictions:
* { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "storage.googleapis.com",
* }
* }
*
* Generated from protobuf enum API_KEY_IP_ADDRESS_BLOCKED = 8;
*/
const API_KEY_IP_ADDRESS_BLOCKED = 8;
/**
* The request is denied because it violates [API key Android application
* restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
* Example of an ErrorInfo when the consumer "projects/123" fails to call
* "storage.googleapis.com" service because the request from the Android apps
* violates the API key Android application restrictions:
* { "reason": "API_KEY_ANDROID_APP_BLOCKED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "storage.googleapis.com"
* }
* }
*
* Generated from protobuf enum API_KEY_ANDROID_APP_BLOCKED = 9;
*/
const API_KEY_ANDROID_APP_BLOCKED = 9;
/**
* The request is denied because it violates [API key iOS application
* restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
* Example of an ErrorInfo when the consumer "projects/123" fails to call
* "storage.googleapis.com" service because the request from the iOS apps
* violates the API key iOS application restrictions:
* { "reason": "API_KEY_IOS_APP_BLOCKED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "storage.googleapis.com"
* }
* }
*
* Generated from protobuf enum API_KEY_IOS_APP_BLOCKED = 13;
*/
const API_KEY_IOS_APP_BLOCKED = 13;
/**
* The request is denied because there is not enough rate quota for the
* consumer.
* Example of an ErrorInfo when the consumer "projects/123" fails to contact
* "pubsub.googleapis.com" service because consumer's rate quota usage has
* reached the maximum value set for the quota limit
* "ReadsPerMinutePerProject" on the quota metric
* "pubsub.googleapis.com/read_requests":
* { "reason": "RATE_LIMIT_EXCEEDED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "pubsub.googleapis.com",
* "quota_metric": "pubsub.googleapis.com/read_requests",
* "quota_limit": "ReadsPerMinutePerProject"
* }
* }
* Example of an ErrorInfo when the consumer "projects/123" checks quota on
* the service "dataflow.googleapis.com" and hits the organization quota
* limit "DefaultRequestsPerMinutePerOrganization" on the metric
* "dataflow.googleapis.com/default_requests".
* { "reason": "RATE_LIMIT_EXCEEDED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "dataflow.googleapis.com",
* "quota_metric": "dataflow.googleapis.com/default_requests",
* "quota_limit": "DefaultRequestsPerMinutePerOrganization"
* }
* }
*
* Generated from protobuf enum RATE_LIMIT_EXCEEDED = 5;
*/
const RATE_LIMIT_EXCEEDED = 5;
/**
* The request is denied because there is not enough resource quota for the
* consumer.
* Example of an ErrorInfo when the consumer "projects/123" fails to contact
* "compute.googleapis.com" service because consumer's resource quota usage
* has reached the maximum value set for the quota limit "VMsPerProject"
* on the quota metric "compute.googleapis.com/vms":
* { "reason": "RESOURCE_QUOTA_EXCEEDED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "compute.googleapis.com",
* "quota_metric": "compute.googleapis.com/vms",
* "quota_limit": "VMsPerProject"
* }
* }
* Example of an ErrorInfo when the consumer "projects/123" checks resource
* quota on the service "dataflow.googleapis.com" and hits the organization
* quota limit "jobs-per-organization" on the metric
* "dataflow.googleapis.com/job_count".
* { "reason": "RESOURCE_QUOTA_EXCEEDED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "dataflow.googleapis.com",
* "quota_metric": "dataflow.googleapis.com/job_count",
* "quota_limit": "jobs-per-organization"
* }
* }
*
* Generated from protobuf enum RESOURCE_QUOTA_EXCEEDED = 6;
*/
const RESOURCE_QUOTA_EXCEEDED = 6;
/**
* The request whose associated billing account address is in a tax restricted
* location, violates the local tax restrictions when creating resources in
* the restricted region.
* Example of an ErrorInfo when creating the Cloud Storage Bucket in the
* container "projects/123" under a tax restricted region
* "locations/asia-northeast3":
* { "reason": "LOCATION_TAX_POLICY_VIOLATED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "storage.googleapis.com",
* "location": "locations/asia-northeast3"
* }
* }
* This response indicates creating the Cloud Storage Bucket in
* "locations/asia-northeast3" violates the location tax restriction.
*
* Generated from protobuf enum LOCATION_TAX_POLICY_VIOLATED = 10;
*/
const LOCATION_TAX_POLICY_VIOLATED = 10;
/**
* The request is denied because the caller does not have required permission
* on the user project "projects/123" or the user project is invalid. For more
* information, check the [userProject System
* Parameters](https://cloud.google.com/apis/docs/system-parameters).
* Example of an ErrorInfo when the caller is calling Cloud Storage service
* with insufficient permissions on the user project:
* { "reason": "USER_PROJECT_DENIED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "storage.googleapis.com"
* }
* }
*
* Generated from protobuf enum USER_PROJECT_DENIED = 11;
*/
const USER_PROJECT_DENIED = 11;
/**
* The request is denied because the consumer "projects/123" is suspended due
* to Terms of Service(Tos) violations. Check [Project suspension
* guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
* for more information.
* Example of an ErrorInfo when calling Cloud Storage service with the
* suspended consumer "projects/123":
* { "reason": "CONSUMER_SUSPENDED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "storage.googleapis.com"
* }
* }
*
* Generated from protobuf enum CONSUMER_SUSPENDED = 12;
*/
const CONSUMER_SUSPENDED = 12;
/**
* The request is denied because the associated consumer is invalid. It may be
* in a bad format, cannot be found, or have been deleted.
* Example of an ErrorInfo when calling Cloud Storage service with the
* invalid consumer "projects/123":
* { "reason": "CONSUMER_INVALID",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "storage.googleapis.com"
* }
* }
*
* Generated from protobuf enum CONSUMER_INVALID = 14;
*/
const CONSUMER_INVALID = 14;
/**
* The request is denied because it violates [VPC Service
* Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
* The 'uid' field is a random generated identifier that customer can use it
* to search the audit log for a request rejected by VPC Service Controls. For
* more information, please refer [VPC Service Controls
* Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
* Example of an ErrorInfo when the consumer "projects/123" fails to call
* Cloud Storage service because the request is prohibited by the VPC Service
* Controls.
* { "reason": "SECURITY_POLICY_VIOLATED",
* "domain": "googleapis.com",
* "metadata": {
* "uid": "123456789abcde",
* "consumer": "projects/123",
* "service": "storage.googleapis.com"
* }
* }
*
* Generated from protobuf enum SECURITY_POLICY_VIOLATED = 15;
*/
const SECURITY_POLICY_VIOLATED = 15;
/**
* The request is denied because the provided access token has expired.
* Example of an ErrorInfo when the request is calling Cloud Storage service
* with an expired access token:
* { "reason": "ACCESS_TOKEN_EXPIRED",
* "domain": "googleapis.com",
* "metadata": {
* "service": "storage.googleapis.com",
* "method": "google.storage.v1.Storage.GetObject"
* }
* }
*
* Generated from protobuf enum ACCESS_TOKEN_EXPIRED = 16;
*/
const ACCESS_TOKEN_EXPIRED = 16;
/**
* The request is denied because the provided access token doesn't have at
* least one of the acceptable scopes required for the API. Please check
* [OAuth 2.0 Scopes for Google
* APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
* the list of the OAuth 2.0 scopes that you might need to request to access
* the API.
* Example of an ErrorInfo when the request is calling Cloud Storage service
* with an access token that is missing required scopes:
* { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
* "domain": "googleapis.com",
* "metadata": {
* "service": "storage.googleapis.com",
* "method": "google.storage.v1.Storage.GetObject"
* }
* }
*
* Generated from protobuf enum ACCESS_TOKEN_SCOPE_INSUFFICIENT = 17;
*/
const ACCESS_TOKEN_SCOPE_INSUFFICIENT = 17;
/**
* The request is denied because the account associated with the provided
* access token is in an invalid state, such as disabled or deleted.
* For more information, see https://cloud.google.com/docs/authentication.
* Warning: For privacy reasons, the server may not be able to disclose the
* email address for some accounts. The client MUST NOT depend on the
* availability of the `email` attribute.
* Example of an ErrorInfo when the request is to the Cloud Storage API with
* an access token that is associated with a disabled or deleted [service
* account](http://cloud/iam/docs/service-accounts):
* { "reason": "ACCOUNT_STATE_INVALID",
* "domain": "googleapis.com",
* "metadata": {
* "service": "storage.googleapis.com",
* "method": "google.storage.v1.Storage.GetObject",
* "email": "user@123.iam.gserviceaccount.com"
* }
* }
*
* Generated from protobuf enum ACCOUNT_STATE_INVALID = 18;
*/
const ACCOUNT_STATE_INVALID = 18;
/**
* The request is denied because the type of the provided access token is not
* supported by the API being called.
* Example of an ErrorInfo when the request is to the Cloud Storage API with
* an unsupported token type.
* { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
* "domain": "googleapis.com",
* "metadata": {
* "service": "storage.googleapis.com",
* "method": "google.storage.v1.Storage.GetObject"
* }
* }
*
* Generated from protobuf enum ACCESS_TOKEN_TYPE_UNSUPPORTED = 19;
*/
const ACCESS_TOKEN_TYPE_UNSUPPORTED = 19;
/**
* The request is denied because the request doesn't have any authentication
* credentials. For more information regarding the supported authentication
* strategies for Google Cloud APIs, see
* https://cloud.google.com/docs/authentication.
* Example of an ErrorInfo when the request is to the Cloud Storage API
* without any authentication credentials.
* { "reason": "CREDENTIALS_MISSING",
* "domain": "googleapis.com",
* "metadata": {
* "service": "storage.googleapis.com",
* "method": "google.storage.v1.Storage.GetObject"
* }
* }
*
* Generated from protobuf enum CREDENTIALS_MISSING = 20;
*/
const CREDENTIALS_MISSING = 20;
/**
* The request is denied because the provided project owning the resource
* which acts as the [API
* consumer](https://cloud.google.com/apis/design/glossary#api_consumer) is
* invalid. It may be in a bad format or empty.
* Example of an ErrorInfo when the request is to the Cloud Functions API,
* but the offered resource project in the request in a bad format which can't
* perform the ListFunctions method.
* { "reason": "RESOURCE_PROJECT_INVALID",
* "domain": "googleapis.com",
* "metadata": {
* "service": "cloudfunctions.googleapis.com",
* "method":
* "google.cloud.functions.v1.CloudFunctionsService.ListFunctions"
* }
* }
*
* Generated from protobuf enum RESOURCE_PROJECT_INVALID = 21;
*/
const RESOURCE_PROJECT_INVALID = 21;
/**
* The request is denied because the provided session cookie is missing,
* invalid or failed to decode.
* Example of an ErrorInfo when the request is calling Cloud Storage service
* with a SID cookie which can't be decoded.
* { "reason": "SESSION_COOKIE_INVALID",
* "domain": "googleapis.com",
* "metadata": {
* "service": "storage.googleapis.com",
* "method": "google.storage.v1.Storage.GetObject",
* "cookie": "SID"
* }
* }
*
* Generated from protobuf enum SESSION_COOKIE_INVALID = 23;
*/
const SESSION_COOKIE_INVALID = 23;
/**
* The request is denied because the user is from a Google Workspace customer
* that blocks their users from accessing a particular service.
* Example scenario: https://support.google.com/a/answer/9197205?hl=en
* Example of an ErrorInfo when access to Google Cloud Storage service is
* blocked by the Google Workspace administrator:
* { "reason": "USER_BLOCKED_BY_ADMIN",
* "domain": "googleapis.com",
* "metadata": {
* "service": "storage.googleapis.com",
* "method": "google.storage.v1.Storage.GetObject",
* }
* }
*
* Generated from protobuf enum USER_BLOCKED_BY_ADMIN = 24;
*/
const USER_BLOCKED_BY_ADMIN = 24;
/**
* The request is denied because the resource service usage is restricted
* by administrators according to the organization policy constraint.
* For more information see
* https://cloud.google.com/resource-manager/docs/organization-policy/restricting-services.
* Example of an ErrorInfo when access to Google Cloud Storage service is
* restricted by Resource Usage Restriction policy:
* { "reason": "RESOURCE_USAGE_RESTRICTION_VIOLATED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/project-123",
* "service": "storage.googleapis.com"
* }
* }
*
* Generated from protobuf enum RESOURCE_USAGE_RESTRICTION_VIOLATED = 25;
*/
const RESOURCE_USAGE_RESTRICTION_VIOLATED = 25;
/**
* Unimplemented. Do not use.
* The request is denied because it contains unsupported system parameters in
* URL query parameters or HTTP headers. For more information,
* see https://cloud.google.com/apis/docs/system-parameters
* Example of an ErrorInfo when access "pubsub.googleapis.com" service with
* a request header of "x-goog-user-ip":
* { "reason": "SYSTEM_PARAMETER_UNSUPPORTED",
* "domain": "googleapis.com",
* "metadata": {
* "service": "pubsub.googleapis.com"
* "parameter": "x-goog-user-ip"
* }
* }
*
* Generated from protobuf enum SYSTEM_PARAMETER_UNSUPPORTED = 26;
*/
const SYSTEM_PARAMETER_UNSUPPORTED = 26;
/**
* The request is denied because it violates Org Restriction: the requested
* resource does not belong to allowed organizations specified in
* "X-Goog-Allowed-Resources" header.
* Example of an ErrorInfo when accessing a GCP resource that is restricted by
* Org Restriction for "pubsub.googleapis.com" service.
* {
* reason: "ORG_RESTRICTION_VIOLATION"
* domain: "googleapis.com"
* metadata {
* "consumer":"projects/123456"
* "service": "pubsub.googleapis.com"
* }
* }
*
* Generated from protobuf enum ORG_RESTRICTION_VIOLATION = 27;
*/
const ORG_RESTRICTION_VIOLATION = 27;
/**
* The request is denied because "X-Goog-Allowed-Resources" header is in a bad
* format.
* Example of an ErrorInfo when
* accessing "pubsub.googleapis.com" service with an invalid
* "X-Goog-Allowed-Resources" request header.
* {
* reason: "ORG_RESTRICTION_HEADER_INVALID"
* domain: "googleapis.com"
* metadata {
* "consumer":"projects/123456"
* "service": "pubsub.googleapis.com"
* }
* }
*
* Generated from protobuf enum ORG_RESTRICTION_HEADER_INVALID = 28;
*/
const ORG_RESTRICTION_HEADER_INVALID = 28;
/**
* Unimplemented. Do not use.
* The request is calling a service that is not visible to the consumer.
* Example of an ErrorInfo when the consumer "projects/123" contacting
* "pubsub.googleapis.com" service which is not visible to the consumer.
* { "reason": "SERVICE_NOT_VISIBLE",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "pubsub.googleapis.com"
* }
* }
* This response indicates the "pubsub.googleapis.com" is not visible to
* "projects/123" (or it may not exist).
*
* Generated from protobuf enum SERVICE_NOT_VISIBLE = 29;
*/
const SERVICE_NOT_VISIBLE = 29;
/**
* The request is related to a project for which GCP access is suspended.
* Example of an ErrorInfo when the consumer "projects/123" fails to contact
* "pubsub.googleapis.com" service because GCP access is suspended:
* { "reason": "GCP_SUSPENDED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "pubsub.googleapis.com"
* }
* }
* This response indicates the associated GCP account has been suspended.
*
* Generated from protobuf enum GCP_SUSPENDED = 30;
*/
const GCP_SUSPENDED = 30;
/**
* The request violates the location policies when creating resources in
* the restricted region.
* Example of an ErrorInfo when creating the Cloud Storage Bucket by
* "projects/123" for service storage.googleapis.com:
* { "reason": "LOCATION_POLICY_VIOLATED",
* "domain": "googleapis.com",
* "metadata": {
* "consumer": "projects/123",
* "service": "storage.googleapis.com",
* }
* }
* This response indicates creating the Cloud Storage Bucket in
* "locations/asia-northeast3" violates at least one location policy.
* The troubleshooting guidance is provided in the Help links.
*
* Generated from protobuf enum LOCATION_POLICY_VIOLATED = 31;
*/
const LOCATION_POLICY_VIOLATED = 31;
/**
* The request is denied because origin request header is missing.
* Example of an ErrorInfo when
* accessing "pubsub.googleapis.com" service with an empty "Origin" request
* header.
* {
* reason: "MISSING_ORIGIN"
* domain: "googleapis.com"
* metadata {
* "consumer":"projects/123456"
* "service": "pubsub.googleapis.com"
* }
* }
*
* Generated from protobuf enum MISSING_ORIGIN = 33;
*/
const MISSING_ORIGIN = 33;
/**
* The request is denied because the request contains more than one credential
* type that are individually acceptable, but not together. The customer
* should retry their request with only one set of credentials.
* Example of an ErrorInfo when
* accessing "pubsub.googleapis.com" service with overloaded credentials.
* {
* reason: "OVERLOADED_CREDENTIALS"
* domain: "googleapis.com"
* metadata {
* "consumer":"projects/123456"
* "service": "pubsub.googleapis.com"
* }
* }
*
* Generated from protobuf enum OVERLOADED_CREDENTIALS = 34;
*/
const OVERLOADED_CREDENTIALS = 34;
private static $valueToName = [
self::ERROR_REASON_UNSPECIFIED => 'ERROR_REASON_UNSPECIFIED',
self::SERVICE_DISABLED => 'SERVICE_DISABLED',
self::BILLING_DISABLED => 'BILLING_DISABLED',
self::API_KEY_INVALID => 'API_KEY_INVALID',
self::API_KEY_SERVICE_BLOCKED => 'API_KEY_SERVICE_BLOCKED',
self::API_KEY_HTTP_REFERRER_BLOCKED => 'API_KEY_HTTP_REFERRER_BLOCKED',
self::API_KEY_IP_ADDRESS_BLOCKED => 'API_KEY_IP_ADDRESS_BLOCKED',
self::API_KEY_ANDROID_APP_BLOCKED => 'API_KEY_ANDROID_APP_BLOCKED',
self::API_KEY_IOS_APP_BLOCKED => 'API_KEY_IOS_APP_BLOCKED',
self::RATE_LIMIT_EXCEEDED => 'RATE_LIMIT_EXCEEDED',
self::RESOURCE_QUOTA_EXCEEDED => 'RESOURCE_QUOTA_EXCEEDED',
self::LOCATION_TAX_POLICY_VIOLATED => 'LOCATION_TAX_POLICY_VIOLATED',
self::USER_PROJECT_DENIED => 'USER_PROJECT_DENIED',
self::CONSUMER_SUSPENDED => 'CONSUMER_SUSPENDED',
self::CONSUMER_INVALID => 'CONSUMER_INVALID',
self::SECURITY_POLICY_VIOLATED => 'SECURITY_POLICY_VIOLATED',
self::ACCESS_TOKEN_EXPIRED => 'ACCESS_TOKEN_EXPIRED',
self::ACCESS_TOKEN_SCOPE_INSUFFICIENT => 'ACCESS_TOKEN_SCOPE_INSUFFICIENT',
self::ACCOUNT_STATE_INVALID => 'ACCOUNT_STATE_INVALID',
self::ACCESS_TOKEN_TYPE_UNSUPPORTED => 'ACCESS_TOKEN_TYPE_UNSUPPORTED',
self::CREDENTIALS_MISSING => 'CREDENTIALS_MISSING',
self::RESOURCE_PROJECT_INVALID => 'RESOURCE_PROJECT_INVALID',
self::SESSION_COOKIE_INVALID => 'SESSION_COOKIE_INVALID',
self::USER_BLOCKED_BY_ADMIN => 'USER_BLOCKED_BY_ADMIN',
self::RESOURCE_USAGE_RESTRICTION_VIOLATED => 'RESOURCE_USAGE_RESTRICTION_VIOLATED',
self::SYSTEM_PARAMETER_UNSUPPORTED => 'SYSTEM_PARAMETER_UNSUPPORTED',
self::ORG_RESTRICTION_VIOLATION => 'ORG_RESTRICTION_VIOLATION',
self::ORG_RESTRICTION_HEADER_INVALID => 'ORG_RESTRICTION_HEADER_INVALID',
self::SERVICE_NOT_VISIBLE => 'SERVICE_NOT_VISIBLE',
self::GCP_SUSPENDED => 'GCP_SUSPENDED',
self::LOCATION_POLICY_VIOLATED => 'LOCATION_POLICY_VIOLATED',
self::MISSING_ORIGIN => 'MISSING_ORIGIN',
self::OVERLOADED_CREDENTIALS => 'OVERLOADED_CREDENTIALS',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/FieldBehavior.php
================================================
google.api.FieldBehavior
*/
class FieldBehavior
{
/**
* Conventional default for enums. Do not use this.
*
* Generated from protobuf enum FIELD_BEHAVIOR_UNSPECIFIED = 0;
*/
const FIELD_BEHAVIOR_UNSPECIFIED = 0;
/**
* Specifically denotes a field as optional.
* While all fields in protocol buffers are optional, this may be specified
* for emphasis if appropriate.
*
* Generated from protobuf enum OPTIONAL = 1;
*/
const OPTIONAL = 1;
/**
* Denotes a field as required.
* This indicates that the field **must** be provided as part of the request,
* and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
*
* Generated from protobuf enum REQUIRED = 2;
*/
const REQUIRED = 2;
/**
* Denotes a field as output only.
* This indicates that the field is provided in responses, but including the
* field in a request does nothing (the server *must* ignore it and
* *must not* throw an error as a result of the field's presence).
*
* Generated from protobuf enum OUTPUT_ONLY = 3;
*/
const OUTPUT_ONLY = 3;
/**
* Denotes a field as input only.
* This indicates that the field is provided in requests, and the
* corresponding field is not included in output.
*
* Generated from protobuf enum INPUT_ONLY = 4;
*/
const INPUT_ONLY = 4;
/**
* Denotes a field as immutable.
* This indicates that the field may be set once in a request to create a
* resource, but may not be changed thereafter.
*
* Generated from protobuf enum IMMUTABLE = 5;
*/
const IMMUTABLE = 5;
/**
* Denotes that a (repeated) field is an unordered list.
* This indicates that the service may provide the elements of the list
* in any arbitrary order, rather than the order the user originally
* provided. Additionally, the list's order may or may not be stable.
*
* Generated from protobuf enum UNORDERED_LIST = 6;
*/
const UNORDERED_LIST = 6;
/**
* Denotes that this field returns a non-empty default value if not set.
* This indicates that if the user provides the empty value in a request,
* a non-empty value will be returned. The user will not be aware of what
* non-empty value to expect.
*
* Generated from protobuf enum NON_EMPTY_DEFAULT = 7;
*/
const NON_EMPTY_DEFAULT = 7;
/**
* Denotes that the field in a resource (a message annotated with
* google.api.resource) is used in the resource name to uniquely identify the
* resource. For AIP-compliant APIs, this should only be applied to the
* `name` field on the resource.
* This behavior should not be applied to references to other resources within
* the message.
* The identifier field of resources often have different field behavior
* depending on the request it is embedded in (e.g. for Create methods name
* is optional and unused, while for Update methods it is required). Instead
* of method-specific annotations, only `IDENTIFIER` is required.
*
* Generated from protobuf enum IDENTIFIER = 8;
*/
const IDENTIFIER = 8;
private static $valueToName = [
self::FIELD_BEHAVIOR_UNSPECIFIED => 'FIELD_BEHAVIOR_UNSPECIFIED',
self::OPTIONAL => 'OPTIONAL',
self::REQUIRED => 'REQUIRED',
self::OUTPUT_ONLY => 'OUTPUT_ONLY',
self::INPUT_ONLY => 'INPUT_ONLY',
self::IMMUTABLE => 'IMMUTABLE',
self::UNORDERED_LIST => 'UNORDERED_LIST',
self::NON_EMPTY_DEFAULT => 'NON_EMPTY_DEFAULT',
self::IDENTIFIER => 'IDENTIFIER',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/FieldInfo/Format.php
================================================
google.api.FieldInfo.Format
*/
class Format
{
/**
* Default, unspecified value.
*
* Generated from protobuf enum FORMAT_UNSPECIFIED = 0;
*/
const FORMAT_UNSPECIFIED = 0;
/**
* Universally Unique Identifier, version 4, value as defined by
* https://datatracker.ietf.org/doc/html/rfc4122. The value may be
* normalized to entirely lowercase letters. For example, the value
* `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
* `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
*
* Generated from protobuf enum UUID4 = 1;
*/
const UUID4 = 1;
/**
* Internet Protocol v4 value as defined by [RFC
* 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
* condensed, with leading zeros in each octet stripped. For example,
* `001.022.233.040` would be condensed to `1.22.233.40`.
*
* Generated from protobuf enum IPV4 = 2;
*/
const IPV4 = 2;
/**
* Internet Protocol v6 value as defined by [RFC
* 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
* normalized to entirely lowercase letters with zeros compressed, following
* [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
* the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
*
* Generated from protobuf enum IPV6 = 3;
*/
const IPV6 = 3;
/**
* An IP address in either v4 or v6 format as described by the individual
* values defined herein. See the comments on the IPV4 and IPV6 types for
* allowed normalizations of each.
*
* Generated from protobuf enum IPV4_OR_IPV6 = 4;
*/
const IPV4_OR_IPV6 = 4;
private static $valueToName = [
self::FORMAT_UNSPECIFIED => 'FORMAT_UNSPECIFIED',
self::UUID4 => 'UUID4',
self::IPV4 => 'IPV4',
self::IPV6 => 'IPV6',
self::IPV4_OR_IPV6 => 'IPV4_OR_IPV6',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/FieldInfo.php
================================================
google.api.FieldInfo
*/
class FieldInfo extends \Google\Protobuf\Internal\Message
{
/**
* The standard format of a field value. This does not explicitly configure
* any API consumer, just documents the API's format for the field it is
* applied to.
*
* Generated from protobuf field .google.api.FieldInfo.Format format = 1;
*/
protected $format = 0;
/**
* The type(s) that the annotated, generic field may represent.
* Currently, this must only be used on fields of type `google.protobuf.Any`.
* Supporting other generic types may be considered in the future.
*
* Generated from protobuf field repeated .google.api.TypeReference referenced_types = 2;
*/
private $referenced_types;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $format
* The standard format of a field value. This does not explicitly configure
* any API consumer, just documents the API's format for the field it is
* applied to.
* @type array<\Google\Api\TypeReference>|\Google\Protobuf\Internal\RepeatedField $referenced_types
* The type(s) that the annotated, generic field may represent.
* Currently, this must only be used on fields of type `google.protobuf.Any`.
* Supporting other generic types may be considered in the future.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\FieldInfo::initOnce();
parent::__construct($data);
}
/**
* The standard format of a field value. This does not explicitly configure
* any API consumer, just documents the API's format for the field it is
* applied to.
*
* Generated from protobuf field .google.api.FieldInfo.Format format = 1;
* @return int
*/
public function getFormat()
{
return $this->format;
}
/**
* The standard format of a field value. This does not explicitly configure
* any API consumer, just documents the API's format for the field it is
* applied to.
*
* Generated from protobuf field .google.api.FieldInfo.Format format = 1;
* @param int $var
* @return $this
*/
public function setFormat($var)
{
GPBUtil::checkEnum($var, \Google\Api\FieldInfo\Format::class);
$this->format = $var;
return $this;
}
/**
* The type(s) that the annotated, generic field may represent.
* Currently, this must only be used on fields of type `google.protobuf.Any`.
* Supporting other generic types may be considered in the future.
*
* Generated from protobuf field repeated .google.api.TypeReference referenced_types = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getReferencedTypes()
{
return $this->referenced_types;
}
/**
* The type(s) that the annotated, generic field may represent.
* Currently, this must only be used on fields of type `google.protobuf.Any`.
* Supporting other generic types may be considered in the future.
*
* Generated from protobuf field repeated .google.api.TypeReference referenced_types = 2;
* @param array<\Google\Api\TypeReference>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setReferencedTypes($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\TypeReference::class);
$this->referenced_types = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/FieldPolicy.php
================================================
google.api.FieldPolicy
*/
class FieldPolicy extends \Google\Protobuf\Internal\Message
{
/**
* Selects one or more request or response message fields to apply this
* `FieldPolicy`.
* When a `FieldPolicy` is used in proto annotation, the selector must
* be left as empty. The service config generator will automatically fill
* the correct value.
* When a `FieldPolicy` is used in service config, the selector must be a
* comma-separated string with valid request or response field paths,
* such as "foo.bar" or "foo.bar,foo.baz".
*
* Generated from protobuf field string selector = 1;
*/
protected $selector = '';
/**
* Specifies the required permission(s) for the resource referred to by the
* field. It requires the field contains a valid resource reference, and
* the request must pass the permission checks to proceed. For example,
* "resourcemanager.projects.get".
*
* Generated from protobuf field string resource_permission = 2;
*/
protected $resource_permission = '';
/**
* Specifies the resource type for the resource referred to by the field.
*
* Generated from protobuf field string resource_type = 3;
*/
protected $resource_type = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $selector
* Selects one or more request or response message fields to apply this
* `FieldPolicy`.
* When a `FieldPolicy` is used in proto annotation, the selector must
* be left as empty. The service config generator will automatically fill
* the correct value.
* When a `FieldPolicy` is used in service config, the selector must be a
* comma-separated string with valid request or response field paths,
* such as "foo.bar" or "foo.bar,foo.baz".
* @type string $resource_permission
* Specifies the required permission(s) for the resource referred to by the
* field. It requires the field contains a valid resource reference, and
* the request must pass the permission checks to proceed. For example,
* "resourcemanager.projects.get".
* @type string $resource_type
* Specifies the resource type for the resource referred to by the field.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Policy::initOnce();
parent::__construct($data);
}
/**
* Selects one or more request or response message fields to apply this
* `FieldPolicy`.
* When a `FieldPolicy` is used in proto annotation, the selector must
* be left as empty. The service config generator will automatically fill
* the correct value.
* When a `FieldPolicy` is used in service config, the selector must be a
* comma-separated string with valid request or response field paths,
* such as "foo.bar" or "foo.bar,foo.baz".
*
* Generated from protobuf field string selector = 1;
* @return string
*/
public function getSelector()
{
return $this->selector;
}
/**
* Selects one or more request or response message fields to apply this
* `FieldPolicy`.
* When a `FieldPolicy` is used in proto annotation, the selector must
* be left as empty. The service config generator will automatically fill
* the correct value.
* When a `FieldPolicy` is used in service config, the selector must be a
* comma-separated string with valid request or response field paths,
* such as "foo.bar" or "foo.bar,foo.baz".
*
* Generated from protobuf field string selector = 1;
* @param string $var
* @return $this
*/
public function setSelector($var)
{
GPBUtil::checkString($var, True);
$this->selector = $var;
return $this;
}
/**
* Specifies the required permission(s) for the resource referred to by the
* field. It requires the field contains a valid resource reference, and
* the request must pass the permission checks to proceed. For example,
* "resourcemanager.projects.get".
*
* Generated from protobuf field string resource_permission = 2;
* @return string
*/
public function getResourcePermission()
{
return $this->resource_permission;
}
/**
* Specifies the required permission(s) for the resource referred to by the
* field. It requires the field contains a valid resource reference, and
* the request must pass the permission checks to proceed. For example,
* "resourcemanager.projects.get".
*
* Generated from protobuf field string resource_permission = 2;
* @param string $var
* @return $this
*/
public function setResourcePermission($var)
{
GPBUtil::checkString($var, True);
$this->resource_permission = $var;
return $this;
}
/**
* Specifies the resource type for the resource referred to by the field.
*
* Generated from protobuf field string resource_type = 3;
* @return string
*/
public function getResourceType()
{
return $this->resource_type;
}
/**
* Specifies the resource type for the resource referred to by the field.
*
* Generated from protobuf field string resource_type = 3;
* @param string $var
* @return $this
*/
public function setResourceType($var)
{
GPBUtil::checkString($var, True);
$this->resource_type = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/GoSettings.php
================================================
google.api.GoSettings
*/
class GoSettings extends \Google\Protobuf\Internal\Message
{
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
*/
protected $common = null;
/**
* Map of service names to renamed services. Keys are the package relative
* service names and values are the name to be used for the service client
* and call options.
* publishing:
* go_settings:
* renamed_services:
* Publisher: TopicAdmin
*
* Generated from protobuf field map renamed_services = 2;
*/
private $renamed_services;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Api\CommonLanguageSettings $common
* Some settings.
* @type array|\Google\Protobuf\Internal\MapField $renamed_services
* Map of service names to renamed services. Keys are the package relative
* service names and values are the name to be used for the service client
* and call options.
* publishing:
* go_settings:
* renamed_services:
* Publisher: TopicAdmin
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @return \Google\Api\CommonLanguageSettings|null
*/
public function getCommon()
{
return $this->common;
}
public function hasCommon()
{
return isset($this->common);
}
public function clearCommon()
{
unset($this->common);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @param \Google\Api\CommonLanguageSettings $var
* @return $this
*/
public function setCommon($var)
{
GPBUtil::checkMessage($var, \Google\Api\CommonLanguageSettings::class);
$this->common = $var;
return $this;
}
/**
* Map of service names to renamed services. Keys are the package relative
* service names and values are the name to be used for the service client
* and call options.
* publishing:
* go_settings:
* renamed_services:
* Publisher: TopicAdmin
*
* Generated from protobuf field map renamed_services = 2;
* @return \Google\Protobuf\Internal\MapField
*/
public function getRenamedServices()
{
return $this->renamed_services;
}
/**
* Map of service names to renamed services. Keys are the package relative
* service names and values are the name to be used for the service client
* and call options.
* publishing:
* go_settings:
* renamed_services:
* Publisher: TopicAdmin
*
* Generated from protobuf field map renamed_services = 2;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setRenamedServices($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->renamed_services = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Http.php
================================================
google.api.Http
*/
class Http extends \Google\Protobuf\Internal\Message
{
/**
* A list of HTTP configuration rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.HttpRule rules = 1;
*/
private $rules;
/**
* When set to true, URL path parameters will be fully URI-decoded except in
* cases of single segment matches in reserved expansion, where "%2F" will be
* left encoded.
* The default behavior is to not decode RFC 6570 reserved characters in multi
* segment matches.
*
* Generated from protobuf field bool fully_decode_reserved_expansion = 2;
*/
protected $fully_decode_reserved_expansion = false;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\HttpRule>|\Google\Protobuf\Internal\RepeatedField $rules
* A list of HTTP configuration rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
* @type bool $fully_decode_reserved_expansion
* When set to true, URL path parameters will be fully URI-decoded except in
* cases of single segment matches in reserved expansion, where "%2F" will be
* left encoded.
* The default behavior is to not decode RFC 6570 reserved characters in multi
* segment matches.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Http::initOnce();
parent::__construct($data);
}
/**
* A list of HTTP configuration rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.HttpRule rules = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getRules()
{
return $this->rules;
}
/**
* A list of HTTP configuration rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.HttpRule rules = 1;
* @param array<\Google\Api\HttpRule>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setRules($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\HttpRule::class);
$this->rules = $arr;
return $this;
}
/**
* When set to true, URL path parameters will be fully URI-decoded except in
* cases of single segment matches in reserved expansion, where "%2F" will be
* left encoded.
* The default behavior is to not decode RFC 6570 reserved characters in multi
* segment matches.
*
* Generated from protobuf field bool fully_decode_reserved_expansion = 2;
* @return bool
*/
public function getFullyDecodeReservedExpansion()
{
return $this->fully_decode_reserved_expansion;
}
/**
* When set to true, URL path parameters will be fully URI-decoded except in
* cases of single segment matches in reserved expansion, where "%2F" will be
* left encoded.
* The default behavior is to not decode RFC 6570 reserved characters in multi
* segment matches.
*
* Generated from protobuf field bool fully_decode_reserved_expansion = 2;
* @param bool $var
* @return $this
*/
public function setFullyDecodeReservedExpansion($var)
{
GPBUtil::checkBool($var);
$this->fully_decode_reserved_expansion = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/HttpBody.php
================================================
google.api.HttpBody
*/
class HttpBody extends \Google\Protobuf\Internal\Message
{
/**
* The HTTP Content-Type header value specifying the content type of the body.
*
* Generated from protobuf field string content_type = 1;
*/
protected $content_type = '';
/**
* The HTTP request/response body as raw binary.
*
* Generated from protobuf field bytes data = 2;
*/
protected $data = '';
/**
* Application specific response metadata. Must be set in the first response
* for streaming APIs.
*
* Generated from protobuf field repeated .google.protobuf.Any extensions = 3;
*/
private $extensions;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $content_type
* The HTTP Content-Type header value specifying the content type of the body.
* @type string $data
* The HTTP request/response body as raw binary.
* @type array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $extensions
* Application specific response metadata. Must be set in the first response
* for streaming APIs.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Httpbody::initOnce();
parent::__construct($data);
}
/**
* The HTTP Content-Type header value specifying the content type of the body.
*
* Generated from protobuf field string content_type = 1;
* @return string
*/
public function getContentType()
{
return $this->content_type;
}
/**
* The HTTP Content-Type header value specifying the content type of the body.
*
* Generated from protobuf field string content_type = 1;
* @param string $var
* @return $this
*/
public function setContentType($var)
{
GPBUtil::checkString($var, True);
$this->content_type = $var;
return $this;
}
/**
* The HTTP request/response body as raw binary.
*
* Generated from protobuf field bytes data = 2;
* @return string
*/
public function getData()
{
return $this->data;
}
/**
* The HTTP request/response body as raw binary.
*
* Generated from protobuf field bytes data = 2;
* @param string $var
* @return $this
*/
public function setData($var)
{
GPBUtil::checkString($var, False);
$this->data = $var;
return $this;
}
/**
* Application specific response metadata. Must be set in the first response
* for streaming APIs.
*
* Generated from protobuf field repeated .google.protobuf.Any extensions = 3;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getExtensions()
{
return $this->extensions;
}
/**
* Application specific response metadata. Must be set in the first response
* for streaming APIs.
*
* Generated from protobuf field repeated .google.protobuf.Any extensions = 3;
* @param array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setExtensions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class);
$this->extensions = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/HttpRule.php
================================================
google.api.HttpRule
*/
class HttpRule extends \Google\Protobuf\Internal\Message
{
/**
* Selects a method to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
*/
protected $selector = '';
/**
* The name of the request field whose value is mapped to the HTTP request
* body, or `*` for mapping all request fields not captured by the path
* pattern to the HTTP body, or omitted for not having any HTTP request body.
* NOTE: the referred field must be present at the top-level of the request
* message type.
*
* Generated from protobuf field string body = 7;
*/
protected $body = '';
/**
* Optional. The name of the response field whose value is mapped to the HTTP
* response body. When omitted, the entire response message will be used
* as the HTTP response body.
* NOTE: The referred field must be present at the top-level of the response
* message type.
*
* Generated from protobuf field string response_body = 12;
*/
protected $response_body = '';
/**
* Additional HTTP bindings for the selector. Nested bindings must
* not contain an `additional_bindings` field themselves (that is,
* the nesting may only be one level deep).
*
* Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11;
*/
private $additional_bindings;
protected $pattern;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $selector
* Selects a method to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
* @type string $get
* Maps to HTTP GET. Used for listing and getting information about
* resources.
* @type string $put
* Maps to HTTP PUT. Used for replacing a resource.
* @type string $post
* Maps to HTTP POST. Used for creating a resource or performing an action.
* @type string $delete
* Maps to HTTP DELETE. Used for deleting a resource.
* @type string $patch
* Maps to HTTP PATCH. Used for updating a resource.
* @type \Google\Api\CustomHttpPattern $custom
* The custom pattern is used for specifying an HTTP method that is not
* included in the `pattern` field, such as HEAD, or "*" to leave the
* HTTP method unspecified for this rule. The wild-card rule is useful
* for services that provide content to Web (HTML) clients.
* @type string $body
* The name of the request field whose value is mapped to the HTTP request
* body, or `*` for mapping all request fields not captured by the path
* pattern to the HTTP body, or omitted for not having any HTTP request body.
* NOTE: the referred field must be present at the top-level of the request
* message type.
* @type string $response_body
* Optional. The name of the response field whose value is mapped to the HTTP
* response body. When omitted, the entire response message will be used
* as the HTTP response body.
* NOTE: The referred field must be present at the top-level of the response
* message type.
* @type array<\Google\Api\HttpRule>|\Google\Protobuf\Internal\RepeatedField $additional_bindings
* Additional HTTP bindings for the selector. Nested bindings must
* not contain an `additional_bindings` field themselves (that is,
* the nesting may only be one level deep).
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Http::initOnce();
parent::__construct($data);
}
/**
* Selects a method to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @return string
*/
public function getSelector()
{
return $this->selector;
}
/**
* Selects a method to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @param string $var
* @return $this
*/
public function setSelector($var)
{
GPBUtil::checkString($var, True);
$this->selector = $var;
return $this;
}
/**
* Maps to HTTP GET. Used for listing and getting information about
* resources.
*
* Generated from protobuf field string get = 2;
* @return string
*/
public function getGet()
{
return $this->readOneof(2);
}
public function hasGet()
{
return $this->hasOneof(2);
}
/**
* Maps to HTTP GET. Used for listing and getting information about
* resources.
*
* Generated from protobuf field string get = 2;
* @param string $var
* @return $this
*/
public function setGet($var)
{
GPBUtil::checkString($var, True);
$this->writeOneof(2, $var);
return $this;
}
/**
* Maps to HTTP PUT. Used for replacing a resource.
*
* Generated from protobuf field string put = 3;
* @return string
*/
public function getPut()
{
return $this->readOneof(3);
}
public function hasPut()
{
return $this->hasOneof(3);
}
/**
* Maps to HTTP PUT. Used for replacing a resource.
*
* Generated from protobuf field string put = 3;
* @param string $var
* @return $this
*/
public function setPut($var)
{
GPBUtil::checkString($var, True);
$this->writeOneof(3, $var);
return $this;
}
/**
* Maps to HTTP POST. Used for creating a resource or performing an action.
*
* Generated from protobuf field string post = 4;
* @return string
*/
public function getPost()
{
return $this->readOneof(4);
}
public function hasPost()
{
return $this->hasOneof(4);
}
/**
* Maps to HTTP POST. Used for creating a resource or performing an action.
*
* Generated from protobuf field string post = 4;
* @param string $var
* @return $this
*/
public function setPost($var)
{
GPBUtil::checkString($var, True);
$this->writeOneof(4, $var);
return $this;
}
/**
* Maps to HTTP DELETE. Used for deleting a resource.
*
* Generated from protobuf field string delete = 5;
* @return string
*/
public function getDelete()
{
return $this->readOneof(5);
}
public function hasDelete()
{
return $this->hasOneof(5);
}
/**
* Maps to HTTP DELETE. Used for deleting a resource.
*
* Generated from protobuf field string delete = 5;
* @param string $var
* @return $this
*/
public function setDelete($var)
{
GPBUtil::checkString($var, True);
$this->writeOneof(5, $var);
return $this;
}
/**
* Maps to HTTP PATCH. Used for updating a resource.
*
* Generated from protobuf field string patch = 6;
* @return string
*/
public function getPatch()
{
return $this->readOneof(6);
}
public function hasPatch()
{
return $this->hasOneof(6);
}
/**
* Maps to HTTP PATCH. Used for updating a resource.
*
* Generated from protobuf field string patch = 6;
* @param string $var
* @return $this
*/
public function setPatch($var)
{
GPBUtil::checkString($var, True);
$this->writeOneof(6, $var);
return $this;
}
/**
* The custom pattern is used for specifying an HTTP method that is not
* included in the `pattern` field, such as HEAD, or "*" to leave the
* HTTP method unspecified for this rule. The wild-card rule is useful
* for services that provide content to Web (HTML) clients.
*
* Generated from protobuf field .google.api.CustomHttpPattern custom = 8;
* @return \Google\Api\CustomHttpPattern|null
*/
public function getCustom()
{
return $this->readOneof(8);
}
public function hasCustom()
{
return $this->hasOneof(8);
}
/**
* The custom pattern is used for specifying an HTTP method that is not
* included in the `pattern` field, such as HEAD, or "*" to leave the
* HTTP method unspecified for this rule. The wild-card rule is useful
* for services that provide content to Web (HTML) clients.
*
* Generated from protobuf field .google.api.CustomHttpPattern custom = 8;
* @param \Google\Api\CustomHttpPattern $var
* @return $this
*/
public function setCustom($var)
{
GPBUtil::checkMessage($var, \Google\Api\CustomHttpPattern::class);
$this->writeOneof(8, $var);
return $this;
}
/**
* The name of the request field whose value is mapped to the HTTP request
* body, or `*` for mapping all request fields not captured by the path
* pattern to the HTTP body, or omitted for not having any HTTP request body.
* NOTE: the referred field must be present at the top-level of the request
* message type.
*
* Generated from protobuf field string body = 7;
* @return string
*/
public function getBody()
{
return $this->body;
}
/**
* The name of the request field whose value is mapped to the HTTP request
* body, or `*` for mapping all request fields not captured by the path
* pattern to the HTTP body, or omitted for not having any HTTP request body.
* NOTE: the referred field must be present at the top-level of the request
* message type.
*
* Generated from protobuf field string body = 7;
* @param string $var
* @return $this
*/
public function setBody($var)
{
GPBUtil::checkString($var, True);
$this->body = $var;
return $this;
}
/**
* Optional. The name of the response field whose value is mapped to the HTTP
* response body. When omitted, the entire response message will be used
* as the HTTP response body.
* NOTE: The referred field must be present at the top-level of the response
* message type.
*
* Generated from protobuf field string response_body = 12;
* @return string
*/
public function getResponseBody()
{
return $this->response_body;
}
/**
* Optional. The name of the response field whose value is mapped to the HTTP
* response body. When omitted, the entire response message will be used
* as the HTTP response body.
* NOTE: The referred field must be present at the top-level of the response
* message type.
*
* Generated from protobuf field string response_body = 12;
* @param string $var
* @return $this
*/
public function setResponseBody($var)
{
GPBUtil::checkString($var, True);
$this->response_body = $var;
return $this;
}
/**
* Additional HTTP bindings for the selector. Nested bindings must
* not contain an `additional_bindings` field themselves (that is,
* the nesting may only be one level deep).
*
* Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getAdditionalBindings()
{
return $this->additional_bindings;
}
/**
* Additional HTTP bindings for the selector. Nested bindings must
* not contain an `additional_bindings` field themselves (that is,
* the nesting may only be one level deep).
*
* Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11;
* @param array<\Google\Api\HttpRule>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setAdditionalBindings($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\HttpRule::class);
$this->additional_bindings = $arr;
return $this;
}
/**
* @return string
*/
public function getPattern()
{
return $this->whichOneof("pattern");
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/JavaSettings.php
================================================
google.api.JavaSettings
*/
class JavaSettings extends \Google\Protobuf\Internal\Message
{
/**
* The package name to use in Java. Clobbers the java_package option
* set in the protobuf. This should be used **only** by APIs
* who have already set the language_settings.java.package_name" field
* in gapic.yaml. API teams should use the protobuf java_package option
* where possible.
* Example of a YAML configuration::
* publishing:
* java_settings:
* library_package: com.google.cloud.pubsub.v1
*
* Generated from protobuf field string library_package = 1;
*/
protected $library_package = '';
/**
* Configure the Java class name to use instead of the service's for its
* corresponding generated GAPIC client. Keys are fully-qualified
* service names as they appear in the protobuf (including the full
* the language_settings.java.interface_names" field in gapic.yaml. API
* teams should otherwise use the service name as it appears in the
* protobuf.
* Example of a YAML configuration::
* publishing:
* java_settings:
* service_class_names:
* - google.pubsub.v1.Publisher: TopicAdmin
* - google.pubsub.v1.Subscriber: SubscriptionAdmin
*
* Generated from protobuf field map service_class_names = 2;
*/
private $service_class_names;
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 3;
*/
protected $common = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $library_package
* The package name to use in Java. Clobbers the java_package option
* set in the protobuf. This should be used **only** by APIs
* who have already set the language_settings.java.package_name" field
* in gapic.yaml. API teams should use the protobuf java_package option
* where possible.
* Example of a YAML configuration::
* publishing:
* java_settings:
* library_package: com.google.cloud.pubsub.v1
* @type array|\Google\Protobuf\Internal\MapField $service_class_names
* Configure the Java class name to use instead of the service's for its
* corresponding generated GAPIC client. Keys are fully-qualified
* service names as they appear in the protobuf (including the full
* the language_settings.java.interface_names" field in gapic.yaml. API
* teams should otherwise use the service name as it appears in the
* protobuf.
* Example of a YAML configuration::
* publishing:
* java_settings:
* service_class_names:
* - google.pubsub.v1.Publisher: TopicAdmin
* - google.pubsub.v1.Subscriber: SubscriptionAdmin
* @type \Google\Api\CommonLanguageSettings $common
* Some settings.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* The package name to use in Java. Clobbers the java_package option
* set in the protobuf. This should be used **only** by APIs
* who have already set the language_settings.java.package_name" field
* in gapic.yaml. API teams should use the protobuf java_package option
* where possible.
* Example of a YAML configuration::
* publishing:
* java_settings:
* library_package: com.google.cloud.pubsub.v1
*
* Generated from protobuf field string library_package = 1;
* @return string
*/
public function getLibraryPackage()
{
return $this->library_package;
}
/**
* The package name to use in Java. Clobbers the java_package option
* set in the protobuf. This should be used **only** by APIs
* who have already set the language_settings.java.package_name" field
* in gapic.yaml. API teams should use the protobuf java_package option
* where possible.
* Example of a YAML configuration::
* publishing:
* java_settings:
* library_package: com.google.cloud.pubsub.v1
*
* Generated from protobuf field string library_package = 1;
* @param string $var
* @return $this
*/
public function setLibraryPackage($var)
{
GPBUtil::checkString($var, True);
$this->library_package = $var;
return $this;
}
/**
* Configure the Java class name to use instead of the service's for its
* corresponding generated GAPIC client. Keys are fully-qualified
* service names as they appear in the protobuf (including the full
* the language_settings.java.interface_names" field in gapic.yaml. API
* teams should otherwise use the service name as it appears in the
* protobuf.
* Example of a YAML configuration::
* publishing:
* java_settings:
* service_class_names:
* - google.pubsub.v1.Publisher: TopicAdmin
* - google.pubsub.v1.Subscriber: SubscriptionAdmin
*
* Generated from protobuf field map service_class_names = 2;
* @return \Google\Protobuf\Internal\MapField
*/
public function getServiceClassNames()
{
return $this->service_class_names;
}
/**
* Configure the Java class name to use instead of the service's for its
* corresponding generated GAPIC client. Keys are fully-qualified
* service names as they appear in the protobuf (including the full
* the language_settings.java.interface_names" field in gapic.yaml. API
* teams should otherwise use the service name as it appears in the
* protobuf.
* Example of a YAML configuration::
* publishing:
* java_settings:
* service_class_names:
* - google.pubsub.v1.Publisher: TopicAdmin
* - google.pubsub.v1.Subscriber: SubscriptionAdmin
*
* Generated from protobuf field map service_class_names = 2;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setServiceClassNames($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->service_class_names = $arr;
return $this;
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 3;
* @return \Google\Api\CommonLanguageSettings|null
*/
public function getCommon()
{
return $this->common;
}
public function hasCommon()
{
return isset($this->common);
}
public function clearCommon()
{
unset($this->common);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 3;
* @param \Google\Api\CommonLanguageSettings $var
* @return $this
*/
public function setCommon($var)
{
GPBUtil::checkMessage($var, \Google\Api\CommonLanguageSettings::class);
$this->common = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/JwtLocation.php
================================================
google.api.JwtLocation
*/
class JwtLocation extends \Google\Protobuf\Internal\Message
{
/**
* The value prefix. The value format is "value_prefix{token}"
* Only applies to "in" header type. Must be empty for "in" query type.
* If not empty, the header value has to match (case sensitive) this prefix.
* If not matched, JWT will not be extracted. If matched, JWT will be
* extracted after the prefix is removed.
* For example, for "Authorization: Bearer {JWT}",
* value_prefix="Bearer " with a space at the end.
*
* Generated from protobuf field string value_prefix = 3;
*/
protected $value_prefix = '';
protected $in;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $header
* Specifies HTTP header name to extract JWT token.
* @type string $query
* Specifies URL query parameter name to extract JWT token.
* @type string $cookie
* Specifies cookie name to extract JWT token.
* @type string $value_prefix
* The value prefix. The value format is "value_prefix{token}"
* Only applies to "in" header type. Must be empty for "in" query type.
* If not empty, the header value has to match (case sensitive) this prefix.
* If not matched, JWT will not be extracted. If matched, JWT will be
* extracted after the prefix is removed.
* For example, for "Authorization: Bearer {JWT}",
* value_prefix="Bearer " with a space at the end.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Auth::initOnce();
parent::__construct($data);
}
/**
* Specifies HTTP header name to extract JWT token.
*
* Generated from protobuf field string header = 1;
* @return string
*/
public function getHeader()
{
return $this->readOneof(1);
}
public function hasHeader()
{
return $this->hasOneof(1);
}
/**
* Specifies HTTP header name to extract JWT token.
*
* Generated from protobuf field string header = 1;
* @param string $var
* @return $this
*/
public function setHeader($var)
{
GPBUtil::checkString($var, True);
$this->writeOneof(1, $var);
return $this;
}
/**
* Specifies URL query parameter name to extract JWT token.
*
* Generated from protobuf field string query = 2;
* @return string
*/
public function getQuery()
{
return $this->readOneof(2);
}
public function hasQuery()
{
return $this->hasOneof(2);
}
/**
* Specifies URL query parameter name to extract JWT token.
*
* Generated from protobuf field string query = 2;
* @param string $var
* @return $this
*/
public function setQuery($var)
{
GPBUtil::checkString($var, True);
$this->writeOneof(2, $var);
return $this;
}
/**
* Specifies cookie name to extract JWT token.
*
* Generated from protobuf field string cookie = 4;
* @return string
*/
public function getCookie()
{
return $this->readOneof(4);
}
public function hasCookie()
{
return $this->hasOneof(4);
}
/**
* Specifies cookie name to extract JWT token.
*
* Generated from protobuf field string cookie = 4;
* @param string $var
* @return $this
*/
public function setCookie($var)
{
GPBUtil::checkString($var, True);
$this->writeOneof(4, $var);
return $this;
}
/**
* The value prefix. The value format is "value_prefix{token}"
* Only applies to "in" header type. Must be empty for "in" query type.
* If not empty, the header value has to match (case sensitive) this prefix.
* If not matched, JWT will not be extracted. If matched, JWT will be
* extracted after the prefix is removed.
* For example, for "Authorization: Bearer {JWT}",
* value_prefix="Bearer " with a space at the end.
*
* Generated from protobuf field string value_prefix = 3;
* @return string
*/
public function getValuePrefix()
{
return $this->value_prefix;
}
/**
* The value prefix. The value format is "value_prefix{token}"
* Only applies to "in" header type. Must be empty for "in" query type.
* If not empty, the header value has to match (case sensitive) this prefix.
* If not matched, JWT will not be extracted. If matched, JWT will be
* extracted after the prefix is removed.
* For example, for "Authorization: Bearer {JWT}",
* value_prefix="Bearer " with a space at the end.
*
* Generated from protobuf field string value_prefix = 3;
* @param string $var
* @return $this
*/
public function setValuePrefix($var)
{
GPBUtil::checkString($var, True);
$this->value_prefix = $var;
return $this;
}
/**
* @return string
*/
public function getIn()
{
return $this->whichOneof("in");
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/LabelDescriptor/ValueType.php
================================================
google.api.LabelDescriptor.ValueType
*/
class ValueType
{
/**
* A variable-length string. This is the default.
*
* Generated from protobuf enum STRING = 0;
*/
const STRING = 0;
/**
* Boolean; true or false.
*
* Generated from protobuf enum BOOL = 1;
*/
const BOOL = 1;
/**
* A 64-bit signed integer.
*
* Generated from protobuf enum INT64 = 2;
*/
const INT64 = 2;
private static $valueToName = [
self::STRING => 'STRING',
self::BOOL => 'BOOL',
self::INT64 => 'INT64',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/LabelDescriptor.php
================================================
google.api.LabelDescriptor
*/
class LabelDescriptor extends \Google\Protobuf\Internal\Message
{
/**
* The label key.
*
* Generated from protobuf field string key = 1;
*/
protected $key = '';
/**
* The type of data that can be assigned to the label.
*
* Generated from protobuf field .google.api.LabelDescriptor.ValueType value_type = 2;
*/
protected $value_type = 0;
/**
* A human-readable description for the label.
*
* Generated from protobuf field string description = 3;
*/
protected $description = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $key
* The label key.
* @type int $value_type
* The type of data that can be assigned to the label.
* @type string $description
* A human-readable description for the label.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Label::initOnce();
parent::__construct($data);
}
/**
* The label key.
*
* Generated from protobuf field string key = 1;
* @return string
*/
public function getKey()
{
return $this->key;
}
/**
* The label key.
*
* Generated from protobuf field string key = 1;
* @param string $var
* @return $this
*/
public function setKey($var)
{
GPBUtil::checkString($var, True);
$this->key = $var;
return $this;
}
/**
* The type of data that can be assigned to the label.
*
* Generated from protobuf field .google.api.LabelDescriptor.ValueType value_type = 2;
* @return int
*/
public function getValueType()
{
return $this->value_type;
}
/**
* The type of data that can be assigned to the label.
*
* Generated from protobuf field .google.api.LabelDescriptor.ValueType value_type = 2;
* @param int $var
* @return $this
*/
public function setValueType($var)
{
GPBUtil::checkEnum($var, \Google\Api\LabelDescriptor\ValueType::class);
$this->value_type = $var;
return $this;
}
/**
* A human-readable description for the label.
*
* Generated from protobuf field string description = 3;
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* A human-readable description for the label.
*
* Generated from protobuf field string description = 3;
* @param string $var
* @return $this
*/
public function setDescription($var)
{
GPBUtil::checkString($var, True);
$this->description = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/LaunchStage.php
================================================
google.api.LaunchStage
*/
class LaunchStage
{
/**
* Do not use this default value.
*
* Generated from protobuf enum LAUNCH_STAGE_UNSPECIFIED = 0;
*/
const LAUNCH_STAGE_UNSPECIFIED = 0;
/**
* The feature is not yet implemented. Users can not use it.
*
* Generated from protobuf enum UNIMPLEMENTED = 6;
*/
const UNIMPLEMENTED = 6;
/**
* Prelaunch features are hidden from users and are only visible internally.
*
* Generated from protobuf enum PRELAUNCH = 7;
*/
const PRELAUNCH = 7;
/**
* Early Access features are limited to a closed group of testers. To use
* these features, you must sign up in advance and sign a Trusted Tester
* agreement (which includes confidentiality provisions). These features may
* be unstable, changed in backward-incompatible ways, and are not
* guaranteed to be released.
*
* Generated from protobuf enum EARLY_ACCESS = 1;
*/
const EARLY_ACCESS = 1;
/**
* Alpha is a limited availability test for releases before they are cleared
* for widespread use. By Alpha, all significant design issues are resolved
* and we are in the process of verifying functionality. Alpha customers
* need to apply for access, agree to applicable terms, and have their
* projects allowlisted. Alpha releases don't have to be feature complete,
* no SLAs are provided, and there are no technical support obligations, but
* they will be far enough along that customers can actually use them in
* test environments or for limited-use tests -- just like they would in
* normal production cases.
*
* Generated from protobuf enum ALPHA = 2;
*/
const ALPHA = 2;
/**
* Beta is the point at which we are ready to open a release for any
* customer to use. There are no SLA or technical support obligations in a
* Beta release. Products will be complete from a feature perspective, but
* may have some open outstanding issues. Beta releases are suitable for
* limited production use cases.
*
* Generated from protobuf enum BETA = 3;
*/
const BETA = 3;
/**
* GA features are open to all developers and are considered stable and
* fully qualified for production use.
*
* Generated from protobuf enum GA = 4;
*/
const GA = 4;
/**
* Deprecated features are scheduled to be shut down and removed. For more
* information, see the "Deprecation Policy" section of our [Terms of
* Service](https://cloud.google.com/terms/)
* and the [Google Cloud Platform Subject to the Deprecation
* Policy](https://cloud.google.com/terms/deprecation) documentation.
*
* Generated from protobuf enum DEPRECATED = 5;
*/
const DEPRECATED = 5;
private static $valueToName = [
self::LAUNCH_STAGE_UNSPECIFIED => 'LAUNCH_STAGE_UNSPECIFIED',
self::UNIMPLEMENTED => 'UNIMPLEMENTED',
self::PRELAUNCH => 'PRELAUNCH',
self::EARLY_ACCESS => 'EARLY_ACCESS',
self::ALPHA => 'ALPHA',
self::BETA => 'BETA',
self::GA => 'GA',
self::DEPRECATED => 'DEPRECATED',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/LogDescriptor.php
================================================
google.api.LogDescriptor
*/
class LogDescriptor extends \Google\Protobuf\Internal\Message
{
/**
* The name of the log. It must be less than 512 characters long and can
* include the following characters: upper- and lower-case alphanumeric
* characters [A-Za-z0-9], and punctuation characters including
* slash, underscore, hyphen, period [/_-.].
*
* Generated from protobuf field string name = 1;
*/
protected $name = '';
/**
* The set of labels that are available to describe a specific log entry.
* Runtime requests that contain labels not specified here are
* considered invalid.
*
* Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2;
*/
private $labels;
/**
* A human-readable description of this log. This information appears in
* the documentation and can contain details.
*
* Generated from protobuf field string description = 3;
*/
protected $description = '';
/**
* The human-readable name for this log. This information appears on
* the user interface and should be concise.
*
* Generated from protobuf field string display_name = 4;
*/
protected $display_name = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* The name of the log. It must be less than 512 characters long and can
* include the following characters: upper- and lower-case alphanumeric
* characters [A-Za-z0-9], and punctuation characters including
* slash, underscore, hyphen, period [/_-.].
* @type array<\Google\Api\LabelDescriptor>|\Google\Protobuf\Internal\RepeatedField $labels
* The set of labels that are available to describe a specific log entry.
* Runtime requests that contain labels not specified here are
* considered invalid.
* @type string $description
* A human-readable description of this log. This information appears in
* the documentation and can contain details.
* @type string $display_name
* The human-readable name for this log. This information appears on
* the user interface and should be concise.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Log::initOnce();
parent::__construct($data);
}
/**
* The name of the log. It must be less than 512 characters long and can
* include the following characters: upper- and lower-case alphanumeric
* characters [A-Za-z0-9], and punctuation characters including
* slash, underscore, hyphen, period [/_-.].
*
* Generated from protobuf field string name = 1;
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The name of the log. It must be less than 512 characters long and can
* include the following characters: upper- and lower-case alphanumeric
* characters [A-Za-z0-9], and punctuation characters including
* slash, underscore, hyphen, period [/_-.].
*
* Generated from protobuf field string name = 1;
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* The set of labels that are available to describe a specific log entry.
* Runtime requests that contain labels not specified here are
* considered invalid.
*
* Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getLabels()
{
return $this->labels;
}
/**
* The set of labels that are available to describe a specific log entry.
* Runtime requests that contain labels not specified here are
* considered invalid.
*
* Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2;
* @param array<\Google\Api\LabelDescriptor>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLabels($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class);
$this->labels = $arr;
return $this;
}
/**
* A human-readable description of this log. This information appears in
* the documentation and can contain details.
*
* Generated from protobuf field string description = 3;
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* A human-readable description of this log. This information appears in
* the documentation and can contain details.
*
* Generated from protobuf field string description = 3;
* @param string $var
* @return $this
*/
public function setDescription($var)
{
GPBUtil::checkString($var, True);
$this->description = $var;
return $this;
}
/**
* The human-readable name for this log. This information appears on
* the user interface and should be concise.
*
* Generated from protobuf field string display_name = 4;
* @return string
*/
public function getDisplayName()
{
return $this->display_name;
}
/**
* The human-readable name for this log. This information appears on
* the user interface and should be concise.
*
* Generated from protobuf field string display_name = 4;
* @param string $var
* @return $this
*/
public function setDisplayName($var)
{
GPBUtil::checkString($var, True);
$this->display_name = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Logging/LoggingDestination.php
================================================
google.api.Logging.LoggingDestination
*/
class LoggingDestination extends \Google\Protobuf\Internal\Message
{
/**
* The monitored resource type. The type must be defined in the
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
*
* Generated from protobuf field string monitored_resource = 3;
*/
protected $monitored_resource = '';
/**
* Names of the logs to be sent to this destination. Each name must
* be defined in the [Service.logs][google.api.Service.logs] section. If the
* log name is not a domain scoped name, it will be automatically prefixed
* with the service name followed by "/".
*
* Generated from protobuf field repeated string logs = 1;
*/
private $logs;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $monitored_resource
* The monitored resource type. The type must be defined in the
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
* @type array|\Google\Protobuf\Internal\RepeatedField $logs
* Names of the logs to be sent to this destination. Each name must
* be defined in the [Service.logs][google.api.Service.logs] section. If the
* log name is not a domain scoped name, it will be automatically prefixed
* with the service name followed by "/".
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Logging::initOnce();
parent::__construct($data);
}
/**
* The monitored resource type. The type must be defined in the
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
*
* Generated from protobuf field string monitored_resource = 3;
* @return string
*/
public function getMonitoredResource()
{
return $this->monitored_resource;
}
/**
* The monitored resource type. The type must be defined in the
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
*
* Generated from protobuf field string monitored_resource = 3;
* @param string $var
* @return $this
*/
public function setMonitoredResource($var)
{
GPBUtil::checkString($var, True);
$this->monitored_resource = $var;
return $this;
}
/**
* Names of the logs to be sent to this destination. Each name must
* be defined in the [Service.logs][google.api.Service.logs] section. If the
* log name is not a domain scoped name, it will be automatically prefixed
* with the service name followed by "/".
*
* Generated from protobuf field repeated string logs = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getLogs()
{
return $this->logs;
}
/**
* Names of the logs to be sent to this destination. Each name must
* be defined in the [Service.logs][google.api.Service.logs] section. If the
* log name is not a domain scoped name, it will be automatically prefixed
* with the service name followed by "/".
*
* Generated from protobuf field repeated string logs = 1;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLogs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->logs = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Logging.php
================================================
google.api.Logging
*/
class Logging extends \Google\Protobuf\Internal\Message
{
/**
* Logging configurations for sending logs to the producer project.
* There can be multiple producer destinations, each one must have a
* different monitored resource type. A log can be used in at most
* one producer destination.
*
* Generated from protobuf field repeated .google.api.Logging.LoggingDestination producer_destinations = 1;
*/
private $producer_destinations;
/**
* Logging configurations for sending logs to the consumer project.
* There can be multiple consumer destinations, each one must have a
* different monitored resource type. A log can be used in at most
* one consumer destination.
*
* Generated from protobuf field repeated .google.api.Logging.LoggingDestination consumer_destinations = 2;
*/
private $consumer_destinations;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\Logging\LoggingDestination>|\Google\Protobuf\Internal\RepeatedField $producer_destinations
* Logging configurations for sending logs to the producer project.
* There can be multiple producer destinations, each one must have a
* different monitored resource type. A log can be used in at most
* one producer destination.
* @type array<\Google\Api\Logging\LoggingDestination>|\Google\Protobuf\Internal\RepeatedField $consumer_destinations
* Logging configurations for sending logs to the consumer project.
* There can be multiple consumer destinations, each one must have a
* different monitored resource type. A log can be used in at most
* one consumer destination.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Logging::initOnce();
parent::__construct($data);
}
/**
* Logging configurations for sending logs to the producer project.
* There can be multiple producer destinations, each one must have a
* different monitored resource type. A log can be used in at most
* one producer destination.
*
* Generated from protobuf field repeated .google.api.Logging.LoggingDestination producer_destinations = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getProducerDestinations()
{
return $this->producer_destinations;
}
/**
* Logging configurations for sending logs to the producer project.
* There can be multiple producer destinations, each one must have a
* different monitored resource type. A log can be used in at most
* one producer destination.
*
* Generated from protobuf field repeated .google.api.Logging.LoggingDestination producer_destinations = 1;
* @param array<\Google\Api\Logging\LoggingDestination>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setProducerDestinations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Logging\LoggingDestination::class);
$this->producer_destinations = $arr;
return $this;
}
/**
* Logging configurations for sending logs to the consumer project.
* There can be multiple consumer destinations, each one must have a
* different monitored resource type. A log can be used in at most
* one consumer destination.
*
* Generated from protobuf field repeated .google.api.Logging.LoggingDestination consumer_destinations = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getConsumerDestinations()
{
return $this->consumer_destinations;
}
/**
* Logging configurations for sending logs to the consumer project.
* There can be multiple consumer destinations, each one must have a
* different monitored resource type. A log can be used in at most
* one consumer destination.
*
* Generated from protobuf field repeated .google.api.Logging.LoggingDestination consumer_destinations = 2;
* @param array<\Google\Api\Logging\LoggingDestination>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setConsumerDestinations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Logging\LoggingDestination::class);
$this->consumer_destinations = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MethodPolicy.php
================================================
google.api.MethodPolicy
*/
class MethodPolicy extends \Google\Protobuf\Internal\Message
{
/**
* Selects a method to which these policies should be enforced, for example,
* "google.pubsub.v1.Subscriber.CreateSubscription".
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
* NOTE: This field must not be set in the proto annotation. It will be
* automatically filled by the service config compiler .
*
* Generated from protobuf field string selector = 9;
*/
protected $selector = '';
/**
* Policies that are applicable to the request message.
*
* Generated from protobuf field repeated .google.api.FieldPolicy request_policies = 2;
*/
private $request_policies;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $selector
* Selects a method to which these policies should be enforced, for example,
* "google.pubsub.v1.Subscriber.CreateSubscription".
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
* NOTE: This field must not be set in the proto annotation. It will be
* automatically filled by the service config compiler .
* @type array<\Google\Api\FieldPolicy>|\Google\Protobuf\Internal\RepeatedField $request_policies
* Policies that are applicable to the request message.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Policy::initOnce();
parent::__construct($data);
}
/**
* Selects a method to which these policies should be enforced, for example,
* "google.pubsub.v1.Subscriber.CreateSubscription".
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
* NOTE: This field must not be set in the proto annotation. It will be
* automatically filled by the service config compiler .
*
* Generated from protobuf field string selector = 9;
* @return string
*/
public function getSelector()
{
return $this->selector;
}
/**
* Selects a method to which these policies should be enforced, for example,
* "google.pubsub.v1.Subscriber.CreateSubscription".
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
* NOTE: This field must not be set in the proto annotation. It will be
* automatically filled by the service config compiler .
*
* Generated from protobuf field string selector = 9;
* @param string $var
* @return $this
*/
public function setSelector($var)
{
GPBUtil::checkString($var, True);
$this->selector = $var;
return $this;
}
/**
* Policies that are applicable to the request message.
*
* Generated from protobuf field repeated .google.api.FieldPolicy request_policies = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getRequestPolicies()
{
return $this->request_policies;
}
/**
* Policies that are applicable to the request message.
*
* Generated from protobuf field repeated .google.api.FieldPolicy request_policies = 2;
* @param array<\Google\Api\FieldPolicy>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setRequestPolicies($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\FieldPolicy::class);
$this->request_policies = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MethodSettings/LongRunning.php
================================================
google.api.MethodSettings.LongRunning
*/
class LongRunning extends \Google\Protobuf\Internal\Message
{
/**
* Initial delay after which the first poll request will be made.
* Default value: 5 seconds.
*
* Generated from protobuf field .google.protobuf.Duration initial_poll_delay = 1;
*/
protected $initial_poll_delay = null;
/**
* Multiplier to gradually increase delay between subsequent polls until it
* reaches max_poll_delay.
* Default value: 1.5.
*
* Generated from protobuf field float poll_delay_multiplier = 2;
*/
protected $poll_delay_multiplier = 0.0;
/**
* Maximum time between two subsequent poll requests.
* Default value: 45 seconds.
*
* Generated from protobuf field .google.protobuf.Duration max_poll_delay = 3;
*/
protected $max_poll_delay = null;
/**
* Total polling timeout.
* Default value: 5 minutes.
*
* Generated from protobuf field .google.protobuf.Duration total_poll_timeout = 4;
*/
protected $total_poll_timeout = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Protobuf\Duration $initial_poll_delay
* Initial delay after which the first poll request will be made.
* Default value: 5 seconds.
* @type float $poll_delay_multiplier
* Multiplier to gradually increase delay between subsequent polls until it
* reaches max_poll_delay.
* Default value: 1.5.
* @type \Google\Protobuf\Duration $max_poll_delay
* Maximum time between two subsequent poll requests.
* Default value: 45 seconds.
* @type \Google\Protobuf\Duration $total_poll_timeout
* Total polling timeout.
* Default value: 5 minutes.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Initial delay after which the first poll request will be made.
* Default value: 5 seconds.
*
* Generated from protobuf field .google.protobuf.Duration initial_poll_delay = 1;
* @return \Google\Protobuf\Duration|null
*/
public function getInitialPollDelay()
{
return $this->initial_poll_delay;
}
public function hasInitialPollDelay()
{
return isset($this->initial_poll_delay);
}
public function clearInitialPollDelay()
{
unset($this->initial_poll_delay);
}
/**
* Initial delay after which the first poll request will be made.
* Default value: 5 seconds.
*
* Generated from protobuf field .google.protobuf.Duration initial_poll_delay = 1;
* @param \Google\Protobuf\Duration $var
* @return $this
*/
public function setInitialPollDelay($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
$this->initial_poll_delay = $var;
return $this;
}
/**
* Multiplier to gradually increase delay between subsequent polls until it
* reaches max_poll_delay.
* Default value: 1.5.
*
* Generated from protobuf field float poll_delay_multiplier = 2;
* @return float
*/
public function getPollDelayMultiplier()
{
return $this->poll_delay_multiplier;
}
/**
* Multiplier to gradually increase delay between subsequent polls until it
* reaches max_poll_delay.
* Default value: 1.5.
*
* Generated from protobuf field float poll_delay_multiplier = 2;
* @param float $var
* @return $this
*/
public function setPollDelayMultiplier($var)
{
GPBUtil::checkFloat($var);
$this->poll_delay_multiplier = $var;
return $this;
}
/**
* Maximum time between two subsequent poll requests.
* Default value: 45 seconds.
*
* Generated from protobuf field .google.protobuf.Duration max_poll_delay = 3;
* @return \Google\Protobuf\Duration|null
*/
public function getMaxPollDelay()
{
return $this->max_poll_delay;
}
public function hasMaxPollDelay()
{
return isset($this->max_poll_delay);
}
public function clearMaxPollDelay()
{
unset($this->max_poll_delay);
}
/**
* Maximum time between two subsequent poll requests.
* Default value: 45 seconds.
*
* Generated from protobuf field .google.protobuf.Duration max_poll_delay = 3;
* @param \Google\Protobuf\Duration $var
* @return $this
*/
public function setMaxPollDelay($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
$this->max_poll_delay = $var;
return $this;
}
/**
* Total polling timeout.
* Default value: 5 minutes.
*
* Generated from protobuf field .google.protobuf.Duration total_poll_timeout = 4;
* @return \Google\Protobuf\Duration|null
*/
public function getTotalPollTimeout()
{
return $this->total_poll_timeout;
}
public function hasTotalPollTimeout()
{
return isset($this->total_poll_timeout);
}
public function clearTotalPollTimeout()
{
unset($this->total_poll_timeout);
}
/**
* Total polling timeout.
* Default value: 5 minutes.
*
* Generated from protobuf field .google.protobuf.Duration total_poll_timeout = 4;
* @param \Google\Protobuf\Duration $var
* @return $this
*/
public function setTotalPollTimeout($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
$this->total_poll_timeout = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MethodSettings.php
================================================
google.api.MethodSettings
*/
class MethodSettings extends \Google\Protobuf\Internal\Message
{
/**
* The fully qualified name of the method, for which the options below apply.
* This is used to find the method to apply the options.
* Example:
* publishing:
* method_settings:
* - selector: google.storage.control.v2.StorageControl.CreateFolder
* # method settings for CreateFolder...
*
* Generated from protobuf field string selector = 1;
*/
protected $selector = '';
/**
* Describes settings to use for long-running operations when generating
* API methods for RPCs. Complements RPCs that use the annotations in
* google/longrunning/operations.proto.
* Example of a YAML configuration::
* publishing:
* method_settings:
* - selector: google.cloud.speech.v2.Speech.BatchRecognize
* long_running:
* initial_poll_delay: 60s # 1 minute
* poll_delay_multiplier: 1.5
* max_poll_delay: 360s # 6 minutes
* total_poll_timeout: 54000s # 90 minutes
*
* Generated from protobuf field .google.api.MethodSettings.LongRunning long_running = 2;
*/
protected $long_running = null;
/**
* List of top-level fields of the request message, that should be
* automatically populated by the client libraries based on their
* (google.api.field_info).format. Currently supported format: UUID4.
* Example of a YAML configuration:
* publishing:
* method_settings:
* - selector: google.example.v1.ExampleService.CreateExample
* auto_populated_fields:
* - request_id
*
* Generated from protobuf field repeated string auto_populated_fields = 3;
*/
private $auto_populated_fields;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $selector
* The fully qualified name of the method, for which the options below apply.
* This is used to find the method to apply the options.
* Example:
* publishing:
* method_settings:
* - selector: google.storage.control.v2.StorageControl.CreateFolder
* # method settings for CreateFolder...
* @type \Google\Api\MethodSettings\LongRunning $long_running
* Describes settings to use for long-running operations when generating
* API methods for RPCs. Complements RPCs that use the annotations in
* google/longrunning/operations.proto.
* Example of a YAML configuration::
* publishing:
* method_settings:
* - selector: google.cloud.speech.v2.Speech.BatchRecognize
* long_running:
* initial_poll_delay: 60s # 1 minute
* poll_delay_multiplier: 1.5
* max_poll_delay: 360s # 6 minutes
* total_poll_timeout: 54000s # 90 minutes
* @type array|\Google\Protobuf\Internal\RepeatedField $auto_populated_fields
* List of top-level fields of the request message, that should be
* automatically populated by the client libraries based on their
* (google.api.field_info).format. Currently supported format: UUID4.
* Example of a YAML configuration:
* publishing:
* method_settings:
* - selector: google.example.v1.ExampleService.CreateExample
* auto_populated_fields:
* - request_id
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* The fully qualified name of the method, for which the options below apply.
* This is used to find the method to apply the options.
* Example:
* publishing:
* method_settings:
* - selector: google.storage.control.v2.StorageControl.CreateFolder
* # method settings for CreateFolder...
*
* Generated from protobuf field string selector = 1;
* @return string
*/
public function getSelector()
{
return $this->selector;
}
/**
* The fully qualified name of the method, for which the options below apply.
* This is used to find the method to apply the options.
* Example:
* publishing:
* method_settings:
* - selector: google.storage.control.v2.StorageControl.CreateFolder
* # method settings for CreateFolder...
*
* Generated from protobuf field string selector = 1;
* @param string $var
* @return $this
*/
public function setSelector($var)
{
GPBUtil::checkString($var, True);
$this->selector = $var;
return $this;
}
/**
* Describes settings to use for long-running operations when generating
* API methods for RPCs. Complements RPCs that use the annotations in
* google/longrunning/operations.proto.
* Example of a YAML configuration::
* publishing:
* method_settings:
* - selector: google.cloud.speech.v2.Speech.BatchRecognize
* long_running:
* initial_poll_delay: 60s # 1 minute
* poll_delay_multiplier: 1.5
* max_poll_delay: 360s # 6 minutes
* total_poll_timeout: 54000s # 90 minutes
*
* Generated from protobuf field .google.api.MethodSettings.LongRunning long_running = 2;
* @return \Google\Api\MethodSettings\LongRunning|null
*/
public function getLongRunning()
{
return $this->long_running;
}
public function hasLongRunning()
{
return isset($this->long_running);
}
public function clearLongRunning()
{
unset($this->long_running);
}
/**
* Describes settings to use for long-running operations when generating
* API methods for RPCs. Complements RPCs that use the annotations in
* google/longrunning/operations.proto.
* Example of a YAML configuration::
* publishing:
* method_settings:
* - selector: google.cloud.speech.v2.Speech.BatchRecognize
* long_running:
* initial_poll_delay: 60s # 1 minute
* poll_delay_multiplier: 1.5
* max_poll_delay: 360s # 6 minutes
* total_poll_timeout: 54000s # 90 minutes
*
* Generated from protobuf field .google.api.MethodSettings.LongRunning long_running = 2;
* @param \Google\Api\MethodSettings\LongRunning $var
* @return $this
*/
public function setLongRunning($var)
{
GPBUtil::checkMessage($var, \Google\Api\MethodSettings\LongRunning::class);
$this->long_running = $var;
return $this;
}
/**
* List of top-level fields of the request message, that should be
* automatically populated by the client libraries based on their
* (google.api.field_info).format. Currently supported format: UUID4.
* Example of a YAML configuration:
* publishing:
* method_settings:
* - selector: google.example.v1.ExampleService.CreateExample
* auto_populated_fields:
* - request_id
*
* Generated from protobuf field repeated string auto_populated_fields = 3;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getAutoPopulatedFields()
{
return $this->auto_populated_fields;
}
/**
* List of top-level fields of the request message, that should be
* automatically populated by the client libraries based on their
* (google.api.field_info).format. Currently supported format: UUID4.
* Example of a YAML configuration:
* publishing:
* method_settings:
* - selector: google.example.v1.ExampleService.CreateExample
* auto_populated_fields:
* - request_id
*
* Generated from protobuf field repeated string auto_populated_fields = 3;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setAutoPopulatedFields($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->auto_populated_fields = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Metric.php
================================================
google.api.Metric
*/
class Metric extends \Google\Protobuf\Internal\Message
{
/**
* An existing metric type, see
* [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
* `custom.googleapis.com/invoice/paid/amount`.
*
* Generated from protobuf field string type = 3;
*/
protected $type = '';
/**
* The set of label values that uniquely identify this metric. All
* labels listed in the `MetricDescriptor` must be assigned values.
*
* Generated from protobuf field map labels = 2;
*/
private $labels;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $type
* An existing metric type, see
* [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
* `custom.googleapis.com/invoice/paid/amount`.
* @type array|\Google\Protobuf\Internal\MapField $labels
* The set of label values that uniquely identify this metric. All
* labels listed in the `MetricDescriptor` must be assigned values.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Metric::initOnce();
parent::__construct($data);
}
/**
* An existing metric type, see
* [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
* `custom.googleapis.com/invoice/paid/amount`.
*
* Generated from protobuf field string type = 3;
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* An existing metric type, see
* [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
* `custom.googleapis.com/invoice/paid/amount`.
*
* Generated from protobuf field string type = 3;
* @param string $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkString($var, True);
$this->type = $var;
return $this;
}
/**
* The set of label values that uniquely identify this metric. All
* labels listed in the `MetricDescriptor` must be assigned values.
*
* Generated from protobuf field map labels = 2;
* @return \Google\Protobuf\Internal\MapField
*/
public function getLabels()
{
return $this->labels;
}
/**
* The set of label values that uniquely identify this metric. All
* labels listed in the `MetricDescriptor` must be assigned values.
*
* Generated from protobuf field map labels = 2;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setLabels($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->labels = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MetricDescriptor/MetricDescriptorMetadata/TimeSeriesResourceHierarchyLevel.php
================================================
google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel
*/
class TimeSeriesResourceHierarchyLevel
{
/**
* Do not use this default value.
*
* Generated from protobuf enum TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED = 0;
*/
const TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED = 0;
/**
* Scopes a metric to a project.
*
* Generated from protobuf enum PROJECT = 1;
*/
const PROJECT = 1;
/**
* Scopes a metric to an organization.
*
* Generated from protobuf enum ORGANIZATION = 2;
*/
const ORGANIZATION = 2;
/**
* Scopes a metric to a folder.
*
* Generated from protobuf enum FOLDER = 3;
*/
const FOLDER = 3;
private static $valueToName = [
self::TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED => 'TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED',
self::PROJECT => 'PROJECT',
self::ORGANIZATION => 'ORGANIZATION',
self::FOLDER => 'FOLDER',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MetricDescriptor/MetricDescriptorMetadata.php
================================================
google.api.MetricDescriptor.MetricDescriptorMetadata
*/
class MetricDescriptorMetadata extends \Google\Protobuf\Internal\Message
{
/**
* Deprecated. Must use the
* [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
* instead.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 1 [deprecated = true];
* @deprecated
*/
protected $launch_stage = 0;
/**
* The sampling period of metric data points. For metrics which are written
* periodically, consecutive data points are stored at this time interval,
* excluding data loss due to errors. Metrics with a higher granularity have
* a smaller sampling period.
*
* Generated from protobuf field .google.protobuf.Duration sample_period = 2;
*/
protected $sample_period = null;
/**
* The delay of data points caused by ingestion. Data points older than this
* age are guaranteed to be ingested and available to be read, excluding
* data loss due to errors.
*
* Generated from protobuf field .google.protobuf.Duration ingest_delay = 3;
*/
protected $ingest_delay = null;
/**
* The scope of the timeseries data of the metric.
*
* Generated from protobuf field repeated .google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel time_series_resource_hierarchy_level = 4;
*/
private $time_series_resource_hierarchy_level;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $launch_stage
* Deprecated. Must use the
* [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
* instead.
* @type \Google\Protobuf\Duration $sample_period
* The sampling period of metric data points. For metrics which are written
* periodically, consecutive data points are stored at this time interval,
* excluding data loss due to errors. Metrics with a higher granularity have
* a smaller sampling period.
* @type \Google\Protobuf\Duration $ingest_delay
* The delay of data points caused by ingestion. Data points older than this
* age are guaranteed to be ingested and available to be read, excluding
* data loss due to errors.
* @type array|\Google\Protobuf\Internal\RepeatedField $time_series_resource_hierarchy_level
* The scope of the timeseries data of the metric.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Metric::initOnce();
parent::__construct($data);
}
/**
* Deprecated. Must use the
* [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
* instead.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 1 [deprecated = true];
* @return int
* @deprecated
*/
public function getLaunchStage()
{
if ($this->launch_stage !== 0) {
@trigger_error('launch_stage is deprecated.', E_USER_DEPRECATED);
}
return $this->launch_stage;
}
/**
* Deprecated. Must use the
* [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
* instead.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 1 [deprecated = true];
* @param int $var
* @return $this
* @deprecated
*/
public function setLaunchStage($var)
{
@trigger_error('launch_stage is deprecated.', E_USER_DEPRECATED);
GPBUtil::checkEnum($var, \Google\Api\LaunchStage::class);
$this->launch_stage = $var;
return $this;
}
/**
* The sampling period of metric data points. For metrics which are written
* periodically, consecutive data points are stored at this time interval,
* excluding data loss due to errors. Metrics with a higher granularity have
* a smaller sampling period.
*
* Generated from protobuf field .google.protobuf.Duration sample_period = 2;
* @return \Google\Protobuf\Duration|null
*/
public function getSamplePeriod()
{
return $this->sample_period;
}
public function hasSamplePeriod()
{
return isset($this->sample_period);
}
public function clearSamplePeriod()
{
unset($this->sample_period);
}
/**
* The sampling period of metric data points. For metrics which are written
* periodically, consecutive data points are stored at this time interval,
* excluding data loss due to errors. Metrics with a higher granularity have
* a smaller sampling period.
*
* Generated from protobuf field .google.protobuf.Duration sample_period = 2;
* @param \Google\Protobuf\Duration $var
* @return $this
*/
public function setSamplePeriod($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
$this->sample_period = $var;
return $this;
}
/**
* The delay of data points caused by ingestion. Data points older than this
* age are guaranteed to be ingested and available to be read, excluding
* data loss due to errors.
*
* Generated from protobuf field .google.protobuf.Duration ingest_delay = 3;
* @return \Google\Protobuf\Duration|null
*/
public function getIngestDelay()
{
return $this->ingest_delay;
}
public function hasIngestDelay()
{
return isset($this->ingest_delay);
}
public function clearIngestDelay()
{
unset($this->ingest_delay);
}
/**
* The delay of data points caused by ingestion. Data points older than this
* age are guaranteed to be ingested and available to be read, excluding
* data loss due to errors.
*
* Generated from protobuf field .google.protobuf.Duration ingest_delay = 3;
* @param \Google\Protobuf\Duration $var
* @return $this
*/
public function setIngestDelay($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
$this->ingest_delay = $var;
return $this;
}
/**
* The scope of the timeseries data of the metric.
*
* Generated from protobuf field repeated .google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel time_series_resource_hierarchy_level = 4;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getTimeSeriesResourceHierarchyLevel()
{
return $this->time_series_resource_hierarchy_level;
}
/**
* The scope of the timeseries data of the metric.
*
* Generated from protobuf field repeated .google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel time_series_resource_hierarchy_level = 4;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setTimeSeriesResourceHierarchyLevel($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Api\MetricDescriptor\MetricDescriptorMetadata\TimeSeriesResourceHierarchyLevel::class);
$this->time_series_resource_hierarchy_level = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MetricDescriptor/MetricKind.php
================================================
google.api.MetricDescriptor.MetricKind
*/
class MetricKind
{
/**
* Do not use this default value.
*
* Generated from protobuf enum METRIC_KIND_UNSPECIFIED = 0;
*/
const METRIC_KIND_UNSPECIFIED = 0;
/**
* An instantaneous measurement of a value.
*
* Generated from protobuf enum GAUGE = 1;
*/
const GAUGE = 1;
/**
* The change in a value during a time interval.
*
* Generated from protobuf enum DELTA = 2;
*/
const DELTA = 2;
/**
* A value accumulated over a time interval. Cumulative
* measurements in a time series should have the same start time
* and increasing end times, until an event resets the cumulative
* value to zero and sets a new start time for the following
* points.
*
* Generated from protobuf enum CUMULATIVE = 3;
*/
const CUMULATIVE = 3;
private static $valueToName = [
self::METRIC_KIND_UNSPECIFIED => 'METRIC_KIND_UNSPECIFIED',
self::GAUGE => 'GAUGE',
self::DELTA => 'DELTA',
self::CUMULATIVE => 'CUMULATIVE',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MetricDescriptor/ValueType.php
================================================
google.api.MetricDescriptor.ValueType
*/
class ValueType
{
/**
* Do not use this default value.
*
* Generated from protobuf enum VALUE_TYPE_UNSPECIFIED = 0;
*/
const VALUE_TYPE_UNSPECIFIED = 0;
/**
* The value is a boolean.
* This value type can be used only if the metric kind is `GAUGE`.
*
* Generated from protobuf enum BOOL = 1;
*/
const BOOL = 1;
/**
* The value is a signed 64-bit integer.
*
* Generated from protobuf enum INT64 = 2;
*/
const INT64 = 2;
/**
* The value is a double precision floating point number.
*
* Generated from protobuf enum DOUBLE = 3;
*/
const DOUBLE = 3;
/**
* The value is a text string.
* This value type can be used only if the metric kind is `GAUGE`.
*
* Generated from protobuf enum STRING = 4;
*/
const STRING = 4;
/**
* The value is a [`Distribution`][google.api.Distribution].
*
* Generated from protobuf enum DISTRIBUTION = 5;
*/
const DISTRIBUTION = 5;
/**
* The value is money.
*
* Generated from protobuf enum MONEY = 6;
*/
const MONEY = 6;
private static $valueToName = [
self::VALUE_TYPE_UNSPECIFIED => 'VALUE_TYPE_UNSPECIFIED',
self::BOOL => 'BOOL',
self::INT64 => 'INT64',
self::DOUBLE => 'DOUBLE',
self::STRING => 'STRING',
self::DISTRIBUTION => 'DISTRIBUTION',
self::MONEY => 'MONEY',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MetricDescriptor.php
================================================
google.api.MetricDescriptor
*/
class MetricDescriptor extends \Google\Protobuf\Internal\Message
{
/**
* The resource name of the metric descriptor.
*
* Generated from protobuf field string name = 1;
*/
protected $name = '';
/**
* The metric type, including its DNS name prefix. The type is not
* URL-encoded. All user-defined metric types have the DNS name
* `custom.googleapis.com` or `external.googleapis.com`. Metric types should
* use a natural hierarchical grouping. For example:
* "custom.googleapis.com/invoice/paid/amount"
* "external.googleapis.com/prometheus/up"
* "appengine.googleapis.com/http/server/response_latencies"
*
* Generated from protobuf field string type = 8;
*/
protected $type = '';
/**
* The set of labels that can be used to describe a specific
* instance of this metric type. For example, the
* `appengine.googleapis.com/http/server/response_latencies` metric
* type has a label for the HTTP response code, `response_code`, so
* you can look at latencies for successful responses or just
* for responses that failed.
*
* Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2;
*/
private $labels;
/**
* Whether the metric records instantaneous values, changes to a value, etc.
* Some combinations of `metric_kind` and `value_type` might not be supported.
*
* Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3;
*/
protected $metric_kind = 0;
/**
* Whether the measurement is an integer, a floating-point number, etc.
* Some combinations of `metric_kind` and `value_type` might not be supported.
*
* Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4;
*/
protected $value_type = 0;
/**
* The units in which the metric value is reported. It is only applicable
* if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
* defines the representation of the stored metric values.
* Different systems might scale the values to be more easily displayed (so a
* value of `0.02kBy` _might_ be displayed as `20By`, and a value of
* `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
* `kBy`, then the value of the metric is always in thousands of bytes, no
* matter how it might be displayed.
* If you want a custom metric to record the exact number of CPU-seconds used
* by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
* `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
* CPU-seconds, then the value is written as `12005`.
* Alternatively, if you want a custom metric to record data in a more
* granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
* `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
* or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
* The supported units are a subset of [The Unified Code for Units of
* Measure](https://unitsofmeasure.org/ucum.html) standard:
* **Basic units (UNIT)**
* * `bit` bit
* * `By` byte
* * `s` second
* * `min` minute
* * `h` hour
* * `d` day
* * `1` dimensionless
* **Prefixes (PREFIX)**
* * `k` kilo (10^3)
* * `M` mega (10^6)
* * `G` giga (10^9)
* * `T` tera (10^12)
* * `P` peta (10^15)
* * `E` exa (10^18)
* * `Z` zetta (10^21)
* * `Y` yotta (10^24)
* * `m` milli (10^-3)
* * `u` micro (10^-6)
* * `n` nano (10^-9)
* * `p` pico (10^-12)
* * `f` femto (10^-15)
* * `a` atto (10^-18)
* * `z` zepto (10^-21)
* * `y` yocto (10^-24)
* * `Ki` kibi (2^10)
* * `Mi` mebi (2^20)
* * `Gi` gibi (2^30)
* * `Ti` tebi (2^40)
* * `Pi` pebi (2^50)
* **Grammar**
* The grammar also includes these connectors:
* * `/` division or ratio (as an infix operator). For examples,
* `kBy/{email}` or `MiBy/10ms` (although you should almost never
* have `/s` in a metric `unit`; rates should always be computed at
* query time from the underlying cumulative or delta value).
* * `.` multiplication or composition (as an infix operator). For
* examples, `GBy.d` or `k{watt}.h`.
* The grammar for a unit is as follows:
* Expression = Component { "." Component } { "/" Component } ;
* Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
* | Annotation
* | "1"
* ;
* Annotation = "{" NAME "}" ;
* Notes:
* * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
* is used alone, then the unit is equivalent to `1`. For examples,
* `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
* * `NAME` is a sequence of non-blank printable ASCII characters not
* containing `{` or `}`.
* * `1` represents a unitary [dimensionless
* unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
* as in `1/s`. It is typically used when none of the basic units are
* appropriate. For example, "new users per day" can be represented as
* `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
* users). Alternatively, "thousands of page views per day" would be
* represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
* value of `5.3` would mean "5300 page views per day").
* * `%` represents dimensionless value of 1/100, and annotates values giving
* a percentage (so the metric values are typically in the range of 0..100,
* and a metric value `3` means "3 percent").
* * `10^2.%` indicates a metric contains a ratio, typically in the range
* 0..1, that will be multiplied by 100 and displayed as a percentage
* (so a metric value `0.03` means "3 percent").
*
* Generated from protobuf field string unit = 5;
*/
protected $unit = '';
/**
* A detailed description of the metric, which can be used in documentation.
*
* Generated from protobuf field string description = 6;
*/
protected $description = '';
/**
* A concise name for the metric, which can be displayed in user interfaces.
* Use sentence case without an ending period, for example "Request count".
* This field is optional but it is recommended to be set for any metrics
* associated with user-visible concepts, such as Quota.
*
* Generated from protobuf field string display_name = 7;
*/
protected $display_name = '';
/**
* Optional. Metadata which can be used to guide usage of the metric.
*
* Generated from protobuf field .google.api.MetricDescriptor.MetricDescriptorMetadata metadata = 10;
*/
protected $metadata = null;
/**
* Optional. The launch stage of the metric definition.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 12;
*/
protected $launch_stage = 0;
/**
* Read-only. If present, then a [time
* series][google.monitoring.v3.TimeSeries], which is identified partially by
* a metric type and a
* [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
* is associated with this metric type can only be associated with one of the
* monitored resource types listed here.
*
* Generated from protobuf field repeated string monitored_resource_types = 13;
*/
private $monitored_resource_types;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* The resource name of the metric descriptor.
* @type string $type
* The metric type, including its DNS name prefix. The type is not
* URL-encoded. All user-defined metric types have the DNS name
* `custom.googleapis.com` or `external.googleapis.com`. Metric types should
* use a natural hierarchical grouping. For example:
* "custom.googleapis.com/invoice/paid/amount"
* "external.googleapis.com/prometheus/up"
* "appengine.googleapis.com/http/server/response_latencies"
* @type array<\Google\Api\LabelDescriptor>|\Google\Protobuf\Internal\RepeatedField $labels
* The set of labels that can be used to describe a specific
* instance of this metric type. For example, the
* `appengine.googleapis.com/http/server/response_latencies` metric
* type has a label for the HTTP response code, `response_code`, so
* you can look at latencies for successful responses or just
* for responses that failed.
* @type int $metric_kind
* Whether the metric records instantaneous values, changes to a value, etc.
* Some combinations of `metric_kind` and `value_type` might not be supported.
* @type int $value_type
* Whether the measurement is an integer, a floating-point number, etc.
* Some combinations of `metric_kind` and `value_type` might not be supported.
* @type string $unit
* The units in which the metric value is reported. It is only applicable
* if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
* defines the representation of the stored metric values.
* Different systems might scale the values to be more easily displayed (so a
* value of `0.02kBy` _might_ be displayed as `20By`, and a value of
* `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
* `kBy`, then the value of the metric is always in thousands of bytes, no
* matter how it might be displayed.
* If you want a custom metric to record the exact number of CPU-seconds used
* by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
* `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
* CPU-seconds, then the value is written as `12005`.
* Alternatively, if you want a custom metric to record data in a more
* granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
* `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
* or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
* The supported units are a subset of [The Unified Code for Units of
* Measure](https://unitsofmeasure.org/ucum.html) standard:
* **Basic units (UNIT)**
* * `bit` bit
* * `By` byte
* * `s` second
* * `min` minute
* * `h` hour
* * `d` day
* * `1` dimensionless
* **Prefixes (PREFIX)**
* * `k` kilo (10^3)
* * `M` mega (10^6)
* * `G` giga (10^9)
* * `T` tera (10^12)
* * `P` peta (10^15)
* * `E` exa (10^18)
* * `Z` zetta (10^21)
* * `Y` yotta (10^24)
* * `m` milli (10^-3)
* * `u` micro (10^-6)
* * `n` nano (10^-9)
* * `p` pico (10^-12)
* * `f` femto (10^-15)
* * `a` atto (10^-18)
* * `z` zepto (10^-21)
* * `y` yocto (10^-24)
* * `Ki` kibi (2^10)
* * `Mi` mebi (2^20)
* * `Gi` gibi (2^30)
* * `Ti` tebi (2^40)
* * `Pi` pebi (2^50)
* **Grammar**
* The grammar also includes these connectors:
* * `/` division or ratio (as an infix operator). For examples,
* `kBy/{email}` or `MiBy/10ms` (although you should almost never
* have `/s` in a metric `unit`; rates should always be computed at
* query time from the underlying cumulative or delta value).
* * `.` multiplication or composition (as an infix operator). For
* examples, `GBy.d` or `k{watt}.h`.
* The grammar for a unit is as follows:
* Expression = Component { "." Component } { "/" Component } ;
* Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
* | Annotation
* | "1"
* ;
* Annotation = "{" NAME "}" ;
* Notes:
* * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
* is used alone, then the unit is equivalent to `1`. For examples,
* `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
* * `NAME` is a sequence of non-blank printable ASCII characters not
* containing `{` or `}`.
* * `1` represents a unitary [dimensionless
* unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
* as in `1/s`. It is typically used when none of the basic units are
* appropriate. For example, "new users per day" can be represented as
* `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
* users). Alternatively, "thousands of page views per day" would be
* represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
* value of `5.3` would mean "5300 page views per day").
* * `%` represents dimensionless value of 1/100, and annotates values giving
* a percentage (so the metric values are typically in the range of 0..100,
* and a metric value `3` means "3 percent").
* * `10^2.%` indicates a metric contains a ratio, typically in the range
* 0..1, that will be multiplied by 100 and displayed as a percentage
* (so a metric value `0.03` means "3 percent").
* @type string $description
* A detailed description of the metric, which can be used in documentation.
* @type string $display_name
* A concise name for the metric, which can be displayed in user interfaces.
* Use sentence case without an ending period, for example "Request count".
* This field is optional but it is recommended to be set for any metrics
* associated with user-visible concepts, such as Quota.
* @type \Google\Api\MetricDescriptor\MetricDescriptorMetadata $metadata
* Optional. Metadata which can be used to guide usage of the metric.
* @type int $launch_stage
* Optional. The launch stage of the metric definition.
* @type array|\Google\Protobuf\Internal\RepeatedField $monitored_resource_types
* Read-only. If present, then a [time
* series][google.monitoring.v3.TimeSeries], which is identified partially by
* a metric type and a
* [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
* is associated with this metric type can only be associated with one of the
* monitored resource types listed here.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Metric::initOnce();
parent::__construct($data);
}
/**
* The resource name of the metric descriptor.
*
* Generated from protobuf field string name = 1;
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The resource name of the metric descriptor.
*
* Generated from protobuf field string name = 1;
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* The metric type, including its DNS name prefix. The type is not
* URL-encoded. All user-defined metric types have the DNS name
* `custom.googleapis.com` or `external.googleapis.com`. Metric types should
* use a natural hierarchical grouping. For example:
* "custom.googleapis.com/invoice/paid/amount"
* "external.googleapis.com/prometheus/up"
* "appengine.googleapis.com/http/server/response_latencies"
*
* Generated from protobuf field string type = 8;
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* The metric type, including its DNS name prefix. The type is not
* URL-encoded. All user-defined metric types have the DNS name
* `custom.googleapis.com` or `external.googleapis.com`. Metric types should
* use a natural hierarchical grouping. For example:
* "custom.googleapis.com/invoice/paid/amount"
* "external.googleapis.com/prometheus/up"
* "appengine.googleapis.com/http/server/response_latencies"
*
* Generated from protobuf field string type = 8;
* @param string $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkString($var, True);
$this->type = $var;
return $this;
}
/**
* The set of labels that can be used to describe a specific
* instance of this metric type. For example, the
* `appengine.googleapis.com/http/server/response_latencies` metric
* type has a label for the HTTP response code, `response_code`, so
* you can look at latencies for successful responses or just
* for responses that failed.
*
* Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getLabels()
{
return $this->labels;
}
/**
* The set of labels that can be used to describe a specific
* instance of this metric type. For example, the
* `appengine.googleapis.com/http/server/response_latencies` metric
* type has a label for the HTTP response code, `response_code`, so
* you can look at latencies for successful responses or just
* for responses that failed.
*
* Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2;
* @param array<\Google\Api\LabelDescriptor>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLabels($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class);
$this->labels = $arr;
return $this;
}
/**
* Whether the metric records instantaneous values, changes to a value, etc.
* Some combinations of `metric_kind` and `value_type` might not be supported.
*
* Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3;
* @return int
*/
public function getMetricKind()
{
return $this->metric_kind;
}
/**
* Whether the metric records instantaneous values, changes to a value, etc.
* Some combinations of `metric_kind` and `value_type` might not be supported.
*
* Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3;
* @param int $var
* @return $this
*/
public function setMetricKind($var)
{
GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor\MetricKind::class);
$this->metric_kind = $var;
return $this;
}
/**
* Whether the measurement is an integer, a floating-point number, etc.
* Some combinations of `metric_kind` and `value_type` might not be supported.
*
* Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4;
* @return int
*/
public function getValueType()
{
return $this->value_type;
}
/**
* Whether the measurement is an integer, a floating-point number, etc.
* Some combinations of `metric_kind` and `value_type` might not be supported.
*
* Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4;
* @param int $var
* @return $this
*/
public function setValueType($var)
{
GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor\ValueType::class);
$this->value_type = $var;
return $this;
}
/**
* The units in which the metric value is reported. It is only applicable
* if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
* defines the representation of the stored metric values.
* Different systems might scale the values to be more easily displayed (so a
* value of `0.02kBy` _might_ be displayed as `20By`, and a value of
* `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
* `kBy`, then the value of the metric is always in thousands of bytes, no
* matter how it might be displayed.
* If you want a custom metric to record the exact number of CPU-seconds used
* by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
* `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
* CPU-seconds, then the value is written as `12005`.
* Alternatively, if you want a custom metric to record data in a more
* granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
* `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
* or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
* The supported units are a subset of [The Unified Code for Units of
* Measure](https://unitsofmeasure.org/ucum.html) standard:
* **Basic units (UNIT)**
* * `bit` bit
* * `By` byte
* * `s` second
* * `min` minute
* * `h` hour
* * `d` day
* * `1` dimensionless
* **Prefixes (PREFIX)**
* * `k` kilo (10^3)
* * `M` mega (10^6)
* * `G` giga (10^9)
* * `T` tera (10^12)
* * `P` peta (10^15)
* * `E` exa (10^18)
* * `Z` zetta (10^21)
* * `Y` yotta (10^24)
* * `m` milli (10^-3)
* * `u` micro (10^-6)
* * `n` nano (10^-9)
* * `p` pico (10^-12)
* * `f` femto (10^-15)
* * `a` atto (10^-18)
* * `z` zepto (10^-21)
* * `y` yocto (10^-24)
* * `Ki` kibi (2^10)
* * `Mi` mebi (2^20)
* * `Gi` gibi (2^30)
* * `Ti` tebi (2^40)
* * `Pi` pebi (2^50)
* **Grammar**
* The grammar also includes these connectors:
* * `/` division or ratio (as an infix operator). For examples,
* `kBy/{email}` or `MiBy/10ms` (although you should almost never
* have `/s` in a metric `unit`; rates should always be computed at
* query time from the underlying cumulative or delta value).
* * `.` multiplication or composition (as an infix operator). For
* examples, `GBy.d` or `k{watt}.h`.
* The grammar for a unit is as follows:
* Expression = Component { "." Component } { "/" Component } ;
* Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
* | Annotation
* | "1"
* ;
* Annotation = "{" NAME "}" ;
* Notes:
* * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
* is used alone, then the unit is equivalent to `1`. For examples,
* `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
* * `NAME` is a sequence of non-blank printable ASCII characters not
* containing `{` or `}`.
* * `1` represents a unitary [dimensionless
* unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
* as in `1/s`. It is typically used when none of the basic units are
* appropriate. For example, "new users per day" can be represented as
* `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
* users). Alternatively, "thousands of page views per day" would be
* represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
* value of `5.3` would mean "5300 page views per day").
* * `%` represents dimensionless value of 1/100, and annotates values giving
* a percentage (so the metric values are typically in the range of 0..100,
* and a metric value `3` means "3 percent").
* * `10^2.%` indicates a metric contains a ratio, typically in the range
* 0..1, that will be multiplied by 100 and displayed as a percentage
* (so a metric value `0.03` means "3 percent").
*
* Generated from protobuf field string unit = 5;
* @return string
*/
public function getUnit()
{
return $this->unit;
}
/**
* The units in which the metric value is reported. It is only applicable
* if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
* defines the representation of the stored metric values.
* Different systems might scale the values to be more easily displayed (so a
* value of `0.02kBy` _might_ be displayed as `20By`, and a value of
* `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
* `kBy`, then the value of the metric is always in thousands of bytes, no
* matter how it might be displayed.
* If you want a custom metric to record the exact number of CPU-seconds used
* by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
* `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
* CPU-seconds, then the value is written as `12005`.
* Alternatively, if you want a custom metric to record data in a more
* granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
* `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
* or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
* The supported units are a subset of [The Unified Code for Units of
* Measure](https://unitsofmeasure.org/ucum.html) standard:
* **Basic units (UNIT)**
* * `bit` bit
* * `By` byte
* * `s` second
* * `min` minute
* * `h` hour
* * `d` day
* * `1` dimensionless
* **Prefixes (PREFIX)**
* * `k` kilo (10^3)
* * `M` mega (10^6)
* * `G` giga (10^9)
* * `T` tera (10^12)
* * `P` peta (10^15)
* * `E` exa (10^18)
* * `Z` zetta (10^21)
* * `Y` yotta (10^24)
* * `m` milli (10^-3)
* * `u` micro (10^-6)
* * `n` nano (10^-9)
* * `p` pico (10^-12)
* * `f` femto (10^-15)
* * `a` atto (10^-18)
* * `z` zepto (10^-21)
* * `y` yocto (10^-24)
* * `Ki` kibi (2^10)
* * `Mi` mebi (2^20)
* * `Gi` gibi (2^30)
* * `Ti` tebi (2^40)
* * `Pi` pebi (2^50)
* **Grammar**
* The grammar also includes these connectors:
* * `/` division or ratio (as an infix operator). For examples,
* `kBy/{email}` or `MiBy/10ms` (although you should almost never
* have `/s` in a metric `unit`; rates should always be computed at
* query time from the underlying cumulative or delta value).
* * `.` multiplication or composition (as an infix operator). For
* examples, `GBy.d` or `k{watt}.h`.
* The grammar for a unit is as follows:
* Expression = Component { "." Component } { "/" Component } ;
* Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
* | Annotation
* | "1"
* ;
* Annotation = "{" NAME "}" ;
* Notes:
* * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
* is used alone, then the unit is equivalent to `1`. For examples,
* `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
* * `NAME` is a sequence of non-blank printable ASCII characters not
* containing `{` or `}`.
* * `1` represents a unitary [dimensionless
* unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
* as in `1/s`. It is typically used when none of the basic units are
* appropriate. For example, "new users per day" can be represented as
* `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
* users). Alternatively, "thousands of page views per day" would be
* represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
* value of `5.3` would mean "5300 page views per day").
* * `%` represents dimensionless value of 1/100, and annotates values giving
* a percentage (so the metric values are typically in the range of 0..100,
* and a metric value `3` means "3 percent").
* * `10^2.%` indicates a metric contains a ratio, typically in the range
* 0..1, that will be multiplied by 100 and displayed as a percentage
* (so a metric value `0.03` means "3 percent").
*
* Generated from protobuf field string unit = 5;
* @param string $var
* @return $this
*/
public function setUnit($var)
{
GPBUtil::checkString($var, True);
$this->unit = $var;
return $this;
}
/**
* A detailed description of the metric, which can be used in documentation.
*
* Generated from protobuf field string description = 6;
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* A detailed description of the metric, which can be used in documentation.
*
* Generated from protobuf field string description = 6;
* @param string $var
* @return $this
*/
public function setDescription($var)
{
GPBUtil::checkString($var, True);
$this->description = $var;
return $this;
}
/**
* A concise name for the metric, which can be displayed in user interfaces.
* Use sentence case without an ending period, for example "Request count".
* This field is optional but it is recommended to be set for any metrics
* associated with user-visible concepts, such as Quota.
*
* Generated from protobuf field string display_name = 7;
* @return string
*/
public function getDisplayName()
{
return $this->display_name;
}
/**
* A concise name for the metric, which can be displayed in user interfaces.
* Use sentence case without an ending period, for example "Request count".
* This field is optional but it is recommended to be set for any metrics
* associated with user-visible concepts, such as Quota.
*
* Generated from protobuf field string display_name = 7;
* @param string $var
* @return $this
*/
public function setDisplayName($var)
{
GPBUtil::checkString($var, True);
$this->display_name = $var;
return $this;
}
/**
* Optional. Metadata which can be used to guide usage of the metric.
*
* Generated from protobuf field .google.api.MetricDescriptor.MetricDescriptorMetadata metadata = 10;
* @return \Google\Api\MetricDescriptor\MetricDescriptorMetadata|null
*/
public function getMetadata()
{
return $this->metadata;
}
public function hasMetadata()
{
return isset($this->metadata);
}
public function clearMetadata()
{
unset($this->metadata);
}
/**
* Optional. Metadata which can be used to guide usage of the metric.
*
* Generated from protobuf field .google.api.MetricDescriptor.MetricDescriptorMetadata metadata = 10;
* @param \Google\Api\MetricDescriptor\MetricDescriptorMetadata $var
* @return $this
*/
public function setMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Api\MetricDescriptor\MetricDescriptorMetadata::class);
$this->metadata = $var;
return $this;
}
/**
* Optional. The launch stage of the metric definition.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 12;
* @return int
*/
public function getLaunchStage()
{
return $this->launch_stage;
}
/**
* Optional. The launch stage of the metric definition.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 12;
* @param int $var
* @return $this
*/
public function setLaunchStage($var)
{
GPBUtil::checkEnum($var, \Google\Api\LaunchStage::class);
$this->launch_stage = $var;
return $this;
}
/**
* Read-only. If present, then a [time
* series][google.monitoring.v3.TimeSeries], which is identified partially by
* a metric type and a
* [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
* is associated with this metric type can only be associated with one of the
* monitored resource types listed here.
*
* Generated from protobuf field repeated string monitored_resource_types = 13;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getMonitoredResourceTypes()
{
return $this->monitored_resource_types;
}
/**
* Read-only. If present, then a [time
* series][google.monitoring.v3.TimeSeries], which is identified partially by
* a metric type and a
* [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
* is associated with this metric type can only be associated with one of the
* monitored resource types listed here.
*
* Generated from protobuf field repeated string monitored_resource_types = 13;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMonitoredResourceTypes($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->monitored_resource_types = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MetricRule.php
================================================
google.api.MetricRule
*/
class MetricRule extends \Google\Protobuf\Internal\Message
{
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
*/
protected $selector = '';
/**
* Metrics to update when the selected methods are called, and the associated
* cost applied to each metric.
* The key of the map is the metric name, and the values are the amount
* increased for the metric against which the quota limits are defined.
* The value must not be negative.
*
* Generated from protobuf field map metric_costs = 2;
*/
private $metric_costs;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $selector
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
* @type array|\Google\Protobuf\Internal\MapField $metric_costs
* Metrics to update when the selected methods are called, and the associated
* cost applied to each metric.
* The key of the map is the metric name, and the values are the amount
* increased for the metric against which the quota limits are defined.
* The value must not be negative.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Quota::initOnce();
parent::__construct($data);
}
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @return string
*/
public function getSelector()
{
return $this->selector;
}
/**
* Selects the methods to which this rule applies.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @param string $var
* @return $this
*/
public function setSelector($var)
{
GPBUtil::checkString($var, True);
$this->selector = $var;
return $this;
}
/**
* Metrics to update when the selected methods are called, and the associated
* cost applied to each metric.
* The key of the map is the metric name, and the values are the amount
* increased for the metric against which the quota limits are defined.
* The value must not be negative.
*
* Generated from protobuf field map metric_costs = 2;
* @return \Google\Protobuf\Internal\MapField
*/
public function getMetricCosts()
{
return $this->metric_costs;
}
/**
* Metrics to update when the selected methods are called, and the associated
* cost applied to each metric.
* The key of the map is the metric name, and the values are the amount
* increased for the metric against which the quota limits are defined.
* The value must not be negative.
*
* Generated from protobuf field map metric_costs = 2;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setMetricCosts($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64);
$this->metric_costs = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MonitoredResource.php
================================================
google.api.MonitoredResource
*/
class MonitoredResource extends \Google\Protobuf\Internal\Message
{
/**
* Required. The monitored resource type. This field must match
* the `type` field of a
* [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
* object. For example, the type of a Compute Engine VM instance is
* `gce_instance`. Some descriptors include the service name in the type; for
* example, the type of a Datastream stream is
* `datastream.googleapis.com/Stream`.
*
* Generated from protobuf field string type = 1;
*/
protected $type = '';
/**
* Required. Values for all of the labels listed in the associated monitored
* resource descriptor. For example, Compute Engine VM instances use the
* labels `"project_id"`, `"instance_id"`, and `"zone"`.
*
* Generated from protobuf field map labels = 2;
*/
private $labels;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $type
* Required. The monitored resource type. This field must match
* the `type` field of a
* [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
* object. For example, the type of a Compute Engine VM instance is
* `gce_instance`. Some descriptors include the service name in the type; for
* example, the type of a Datastream stream is
* `datastream.googleapis.com/Stream`.
* @type array|\Google\Protobuf\Internal\MapField $labels
* Required. Values for all of the labels listed in the associated monitored
* resource descriptor. For example, Compute Engine VM instances use the
* labels `"project_id"`, `"instance_id"`, and `"zone"`.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\MonitoredResource::initOnce();
parent::__construct($data);
}
/**
* Required. The monitored resource type. This field must match
* the `type` field of a
* [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
* object. For example, the type of a Compute Engine VM instance is
* `gce_instance`. Some descriptors include the service name in the type; for
* example, the type of a Datastream stream is
* `datastream.googleapis.com/Stream`.
*
* Generated from protobuf field string type = 1;
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Required. The monitored resource type. This field must match
* the `type` field of a
* [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
* object. For example, the type of a Compute Engine VM instance is
* `gce_instance`. Some descriptors include the service name in the type; for
* example, the type of a Datastream stream is
* `datastream.googleapis.com/Stream`.
*
* Generated from protobuf field string type = 1;
* @param string $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkString($var, True);
$this->type = $var;
return $this;
}
/**
* Required. Values for all of the labels listed in the associated monitored
* resource descriptor. For example, Compute Engine VM instances use the
* labels `"project_id"`, `"instance_id"`, and `"zone"`.
*
* Generated from protobuf field map labels = 2;
* @return \Google\Protobuf\Internal\MapField
*/
public function getLabels()
{
return $this->labels;
}
/**
* Required. Values for all of the labels listed in the associated monitored
* resource descriptor. For example, Compute Engine VM instances use the
* labels `"project_id"`, `"instance_id"`, and `"zone"`.
*
* Generated from protobuf field map labels = 2;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setLabels($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->labels = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MonitoredResourceDescriptor.php
================================================
google.api.MonitoredResourceDescriptor
*/
class MonitoredResourceDescriptor extends \Google\Protobuf\Internal\Message
{
/**
* Optional. The resource name of the monitored resource descriptor:
* `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
* {type} is the value of the `type` field in this object and
* {project_id} is a project ID that provides API-specific context for
* accessing the type. APIs that do not use project information can use the
* resource name format `"monitoredResourceDescriptors/{type}"`.
*
* Generated from protobuf field string name = 5;
*/
protected $name = '';
/**
* Required. The monitored resource type. For example, the type
* `"cloudsql_database"` represents databases in Google Cloud SQL.
* For a list of types, see [Monitored resource
* types](https://cloud.google.com/monitoring/api/resources)
* and [Logging resource
* types](https://cloud.google.com/logging/docs/api/v2/resource-list).
*
* Generated from protobuf field string type = 1;
*/
protected $type = '';
/**
* Optional. A concise name for the monitored resource type that might be
* displayed in user interfaces. It should be a Title Cased Noun Phrase,
* without any article or other determiners. For example,
* `"Google Cloud SQL Database"`.
*
* Generated from protobuf field string display_name = 2;
*/
protected $display_name = '';
/**
* Optional. A detailed description of the monitored resource type that might
* be used in documentation.
*
* Generated from protobuf field string description = 3;
*/
protected $description = '';
/**
* Required. A set of labels used to describe instances of this monitored
* resource type. For example, an individual Google Cloud SQL database is
* identified by values for the labels `"database_id"` and `"zone"`.
*
* Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4;
*/
private $labels;
/**
* Optional. The launch stage of the monitored resource definition.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 7;
*/
protected $launch_stage = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* Optional. The resource name of the monitored resource descriptor:
* `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
* {type} is the value of the `type` field in this object and
* {project_id} is a project ID that provides API-specific context for
* accessing the type. APIs that do not use project information can use the
* resource name format `"monitoredResourceDescriptors/{type}"`.
* @type string $type
* Required. The monitored resource type. For example, the type
* `"cloudsql_database"` represents databases in Google Cloud SQL.
* For a list of types, see [Monitored resource
* types](https://cloud.google.com/monitoring/api/resources)
* and [Logging resource
* types](https://cloud.google.com/logging/docs/api/v2/resource-list).
* @type string $display_name
* Optional. A concise name for the monitored resource type that might be
* displayed in user interfaces. It should be a Title Cased Noun Phrase,
* without any article or other determiners. For example,
* `"Google Cloud SQL Database"`.
* @type string $description
* Optional. A detailed description of the monitored resource type that might
* be used in documentation.
* @type array<\Google\Api\LabelDescriptor>|\Google\Protobuf\Internal\RepeatedField $labels
* Required. A set of labels used to describe instances of this monitored
* resource type. For example, an individual Google Cloud SQL database is
* identified by values for the labels `"database_id"` and `"zone"`.
* @type int $launch_stage
* Optional. The launch stage of the monitored resource definition.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\MonitoredResource::initOnce();
parent::__construct($data);
}
/**
* Optional. The resource name of the monitored resource descriptor:
* `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
* {type} is the value of the `type` field in this object and
* {project_id} is a project ID that provides API-specific context for
* accessing the type. APIs that do not use project information can use the
* resource name format `"monitoredResourceDescriptors/{type}"`.
*
* Generated from protobuf field string name = 5;
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Optional. The resource name of the monitored resource descriptor:
* `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
* {type} is the value of the `type` field in this object and
* {project_id} is a project ID that provides API-specific context for
* accessing the type. APIs that do not use project information can use the
* resource name format `"monitoredResourceDescriptors/{type}"`.
*
* Generated from protobuf field string name = 5;
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* Required. The monitored resource type. For example, the type
* `"cloudsql_database"` represents databases in Google Cloud SQL.
* For a list of types, see [Monitored resource
* types](https://cloud.google.com/monitoring/api/resources)
* and [Logging resource
* types](https://cloud.google.com/logging/docs/api/v2/resource-list).
*
* Generated from protobuf field string type = 1;
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Required. The monitored resource type. For example, the type
* `"cloudsql_database"` represents databases in Google Cloud SQL.
* For a list of types, see [Monitored resource
* types](https://cloud.google.com/monitoring/api/resources)
* and [Logging resource
* types](https://cloud.google.com/logging/docs/api/v2/resource-list).
*
* Generated from protobuf field string type = 1;
* @param string $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkString($var, True);
$this->type = $var;
return $this;
}
/**
* Optional. A concise name for the monitored resource type that might be
* displayed in user interfaces. It should be a Title Cased Noun Phrase,
* without any article or other determiners. For example,
* `"Google Cloud SQL Database"`.
*
* Generated from protobuf field string display_name = 2;
* @return string
*/
public function getDisplayName()
{
return $this->display_name;
}
/**
* Optional. A concise name for the monitored resource type that might be
* displayed in user interfaces. It should be a Title Cased Noun Phrase,
* without any article or other determiners. For example,
* `"Google Cloud SQL Database"`.
*
* Generated from protobuf field string display_name = 2;
* @param string $var
* @return $this
*/
public function setDisplayName($var)
{
GPBUtil::checkString($var, True);
$this->display_name = $var;
return $this;
}
/**
* Optional. A detailed description of the monitored resource type that might
* be used in documentation.
*
* Generated from protobuf field string description = 3;
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Optional. A detailed description of the monitored resource type that might
* be used in documentation.
*
* Generated from protobuf field string description = 3;
* @param string $var
* @return $this
*/
public function setDescription($var)
{
GPBUtil::checkString($var, True);
$this->description = $var;
return $this;
}
/**
* Required. A set of labels used to describe instances of this monitored
* resource type. For example, an individual Google Cloud SQL database is
* identified by values for the labels `"database_id"` and `"zone"`.
*
* Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getLabels()
{
return $this->labels;
}
/**
* Required. A set of labels used to describe instances of this monitored
* resource type. For example, an individual Google Cloud SQL database is
* identified by values for the labels `"database_id"` and `"zone"`.
*
* Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4;
* @param array<\Google\Api\LabelDescriptor>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLabels($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class);
$this->labels = $arr;
return $this;
}
/**
* Optional. The launch stage of the monitored resource definition.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 7;
* @return int
*/
public function getLaunchStage()
{
return $this->launch_stage;
}
/**
* Optional. The launch stage of the monitored resource definition.
*
* Generated from protobuf field .google.api.LaunchStage launch_stage = 7;
* @param int $var
* @return $this
*/
public function setLaunchStage($var)
{
GPBUtil::checkEnum($var, \Google\Api\LaunchStage::class);
$this->launch_stage = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/MonitoredResourceMetadata.php
================================================
google.api.MonitoredResourceMetadata
*/
class MonitoredResourceMetadata extends \Google\Protobuf\Internal\Message
{
/**
* Output only. Values for predefined system metadata labels.
* System labels are a kind of metadata extracted by Google, including
* "machine_image", "vpc", "subnet_id",
* "security_group", "name", etc.
* System label values can be only strings, Boolean values, or a list of
* strings. For example:
* { "name": "my-test-instance",
* "security_group": ["a", "b", "c"],
* "spot_instance": false }
*
* Generated from protobuf field .google.protobuf.Struct system_labels = 1;
*/
protected $system_labels = null;
/**
* Output only. A map of user-defined metadata labels.
*
* Generated from protobuf field map user_labels = 2;
*/
private $user_labels;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Protobuf\Struct $system_labels
* Output only. Values for predefined system metadata labels.
* System labels are a kind of metadata extracted by Google, including
* "machine_image", "vpc", "subnet_id",
* "security_group", "name", etc.
* System label values can be only strings, Boolean values, or a list of
* strings. For example:
* { "name": "my-test-instance",
* "security_group": ["a", "b", "c"],
* "spot_instance": false }
* @type array|\Google\Protobuf\Internal\MapField $user_labels
* Output only. A map of user-defined metadata labels.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\MonitoredResource::initOnce();
parent::__construct($data);
}
/**
* Output only. Values for predefined system metadata labels.
* System labels are a kind of metadata extracted by Google, including
* "machine_image", "vpc", "subnet_id",
* "security_group", "name", etc.
* System label values can be only strings, Boolean values, or a list of
* strings. For example:
* { "name": "my-test-instance",
* "security_group": ["a", "b", "c"],
* "spot_instance": false }
*
* Generated from protobuf field .google.protobuf.Struct system_labels = 1;
* @return \Google\Protobuf\Struct|null
*/
public function getSystemLabels()
{
return $this->system_labels;
}
public function hasSystemLabels()
{
return isset($this->system_labels);
}
public function clearSystemLabels()
{
unset($this->system_labels);
}
/**
* Output only. Values for predefined system metadata labels.
* System labels are a kind of metadata extracted by Google, including
* "machine_image", "vpc", "subnet_id",
* "security_group", "name", etc.
* System label values can be only strings, Boolean values, or a list of
* strings. For example:
* { "name": "my-test-instance",
* "security_group": ["a", "b", "c"],
* "spot_instance": false }
*
* Generated from protobuf field .google.protobuf.Struct system_labels = 1;
* @param \Google\Protobuf\Struct $var
* @return $this
*/
public function setSystemLabels($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
$this->system_labels = $var;
return $this;
}
/**
* Output only. A map of user-defined metadata labels.
*
* Generated from protobuf field map user_labels = 2;
* @return \Google\Protobuf\Internal\MapField
*/
public function getUserLabels()
{
return $this->user_labels;
}
/**
* Output only. A map of user-defined metadata labels.
*
* Generated from protobuf field map user_labels = 2;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setUserLabels($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->user_labels = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Monitoring/MonitoringDestination.php
================================================
google.api.Monitoring.MonitoringDestination
*/
class MonitoringDestination extends \Google\Protobuf\Internal\Message
{
/**
* The monitored resource type. The type must be defined in
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
*
* Generated from protobuf field string monitored_resource = 1;
*/
protected $monitored_resource = '';
/**
* Types of the metrics to report to this monitoring destination.
* Each type must be defined in
* [Service.metrics][google.api.Service.metrics] section.
*
* Generated from protobuf field repeated string metrics = 2;
*/
private $metrics;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $monitored_resource
* The monitored resource type. The type must be defined in
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
* @type array|\Google\Protobuf\Internal\RepeatedField $metrics
* Types of the metrics to report to this monitoring destination.
* Each type must be defined in
* [Service.metrics][google.api.Service.metrics] section.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Monitoring::initOnce();
parent::__construct($data);
}
/**
* The monitored resource type. The type must be defined in
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
*
* Generated from protobuf field string monitored_resource = 1;
* @return string
*/
public function getMonitoredResource()
{
return $this->monitored_resource;
}
/**
* The monitored resource type. The type must be defined in
* [Service.monitored_resources][google.api.Service.monitored_resources]
* section.
*
* Generated from protobuf field string monitored_resource = 1;
* @param string $var
* @return $this
*/
public function setMonitoredResource($var)
{
GPBUtil::checkString($var, True);
$this->monitored_resource = $var;
return $this;
}
/**
* Types of the metrics to report to this monitoring destination.
* Each type must be defined in
* [Service.metrics][google.api.Service.metrics] section.
*
* Generated from protobuf field repeated string metrics = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getMetrics()
{
return $this->metrics;
}
/**
* Types of the metrics to report to this monitoring destination.
* Each type must be defined in
* [Service.metrics][google.api.Service.metrics] section.
*
* Generated from protobuf field repeated string metrics = 2;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMetrics($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->metrics = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Monitoring.php
================================================
google.api.Monitoring
*/
class Monitoring extends \Google\Protobuf\Internal\Message
{
/**
* Monitoring configurations for sending metrics to the producer project.
* There can be multiple producer destinations. A monitored resource type may
* appear in multiple monitoring destinations if different aggregations are
* needed for different sets of metrics associated with that monitored
* resource type. A monitored resource and metric pair may only be used once
* in the Monitoring configuration.
*
* Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination producer_destinations = 1;
*/
private $producer_destinations;
/**
* Monitoring configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations. A monitored resource type may
* appear in multiple monitoring destinations if different aggregations are
* needed for different sets of metrics associated with that monitored
* resource type. A monitored resource and metric pair may only be used once
* in the Monitoring configuration.
*
* Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination consumer_destinations = 2;
*/
private $consumer_destinations;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\Monitoring\MonitoringDestination>|\Google\Protobuf\Internal\RepeatedField $producer_destinations
* Monitoring configurations for sending metrics to the producer project.
* There can be multiple producer destinations. A monitored resource type may
* appear in multiple monitoring destinations if different aggregations are
* needed for different sets of metrics associated with that monitored
* resource type. A monitored resource and metric pair may only be used once
* in the Monitoring configuration.
* @type array<\Google\Api\Monitoring\MonitoringDestination>|\Google\Protobuf\Internal\RepeatedField $consumer_destinations
* Monitoring configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations. A monitored resource type may
* appear in multiple monitoring destinations if different aggregations are
* needed for different sets of metrics associated with that monitored
* resource type. A monitored resource and metric pair may only be used once
* in the Monitoring configuration.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Monitoring::initOnce();
parent::__construct($data);
}
/**
* Monitoring configurations for sending metrics to the producer project.
* There can be multiple producer destinations. A monitored resource type may
* appear in multiple monitoring destinations if different aggregations are
* needed for different sets of metrics associated with that monitored
* resource type. A monitored resource and metric pair may only be used once
* in the Monitoring configuration.
*
* Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination producer_destinations = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getProducerDestinations()
{
return $this->producer_destinations;
}
/**
* Monitoring configurations for sending metrics to the producer project.
* There can be multiple producer destinations. A monitored resource type may
* appear in multiple monitoring destinations if different aggregations are
* needed for different sets of metrics associated with that monitored
* resource type. A monitored resource and metric pair may only be used once
* in the Monitoring configuration.
*
* Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination producer_destinations = 1;
* @param array<\Google\Api\Monitoring\MonitoringDestination>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setProducerDestinations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Monitoring\MonitoringDestination::class);
$this->producer_destinations = $arr;
return $this;
}
/**
* Monitoring configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations. A monitored resource type may
* appear in multiple monitoring destinations if different aggregations are
* needed for different sets of metrics associated with that monitored
* resource type. A monitored resource and metric pair may only be used once
* in the Monitoring configuration.
*
* Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination consumer_destinations = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getConsumerDestinations()
{
return $this->consumer_destinations;
}
/**
* Monitoring configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations. A monitored resource type may
* appear in multiple monitoring destinations if different aggregations are
* needed for different sets of metrics associated with that monitored
* resource type. A monitored resource and metric pair may only be used once
* in the Monitoring configuration.
*
* Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination consumer_destinations = 2;
* @param array<\Google\Api\Monitoring\MonitoringDestination>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setConsumerDestinations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Monitoring\MonitoringDestination::class);
$this->consumer_destinations = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/NodeSettings.php
================================================
google.api.NodeSettings
*/
class NodeSettings extends \Google\Protobuf\Internal\Message
{
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
*/
protected $common = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Api\CommonLanguageSettings $common
* Some settings.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @return \Google\Api\CommonLanguageSettings|null
*/
public function getCommon()
{
return $this->common;
}
public function hasCommon()
{
return isset($this->common);
}
public function clearCommon()
{
unset($this->common);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @param \Google\Api\CommonLanguageSettings $var
* @return $this
*/
public function setCommon($var)
{
GPBUtil::checkMessage($var, \Google\Api\CommonLanguageSettings::class);
$this->common = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/OAuthRequirements.php
================================================
google.api.OAuthRequirements
*/
class OAuthRequirements extends \Google\Protobuf\Internal\Message
{
/**
* The list of publicly documented OAuth scopes that are allowed access. An
* OAuth token containing any of these scopes will be accepted.
* Example:
* canonical_scopes: https://www.googleapis.com/auth/calendar,
* https://www.googleapis.com/auth/calendar.read
*
* Generated from protobuf field string canonical_scopes = 1;
*/
protected $canonical_scopes = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $canonical_scopes
* The list of publicly documented OAuth scopes that are allowed access. An
* OAuth token containing any of these scopes will be accepted.
* Example:
* canonical_scopes: https://www.googleapis.com/auth/calendar,
* https://www.googleapis.com/auth/calendar.read
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Auth::initOnce();
parent::__construct($data);
}
/**
* The list of publicly documented OAuth scopes that are allowed access. An
* OAuth token containing any of these scopes will be accepted.
* Example:
* canonical_scopes: https://www.googleapis.com/auth/calendar,
* https://www.googleapis.com/auth/calendar.read
*
* Generated from protobuf field string canonical_scopes = 1;
* @return string
*/
public function getCanonicalScopes()
{
return $this->canonical_scopes;
}
/**
* The list of publicly documented OAuth scopes that are allowed access. An
* OAuth token containing any of these scopes will be accepted.
* Example:
* canonical_scopes: https://www.googleapis.com/auth/calendar,
* https://www.googleapis.com/auth/calendar.read
*
* Generated from protobuf field string canonical_scopes = 1;
* @param string $var
* @return $this
*/
public function setCanonicalScopes($var)
{
GPBUtil::checkString($var, True);
$this->canonical_scopes = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Page.php
================================================
google.api.Page
*/
class Page extends \Google\Protobuf\Internal\Message
{
/**
* The name of the page. It will be used as an identity of the page to
* generate URI of the page, text of the link to this page in navigation,
* etc. The full page name (start from the root page name to this page
* concatenated with `.`) can be used as reference to the page in your
* documentation. For example:
* pages:
* - name: Tutorial
* content: (== include tutorial.md ==)
* subpages:
* - name: Java
* content: (== include tutorial_java.md ==)
*
* You can reference `Java` page using Markdown reference link syntax:
* `[Java][Tutorial.Java]`.
*
* Generated from protobuf field string name = 1;
*/
protected $name = '';
/**
* The Markdown content of the page. You can use ```(== include {path}
* ==)``` to include content from a Markdown file. The content can be used
* to produce the documentation page such as HTML format page.
*
* Generated from protobuf field string content = 2;
*/
protected $content = '';
/**
* Subpages of this page. The order of subpages specified here will be
* honored in the generated docset.
*
* Generated from protobuf field repeated .google.api.Page subpages = 3;
*/
private $subpages;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* The name of the page. It will be used as an identity of the page to
* generate URI of the page, text of the link to this page in navigation,
* etc. The full page name (start from the root page name to this page
* concatenated with `.`) can be used as reference to the page in your
* documentation. For example:
* pages:
* - name: Tutorial
* content: (== include tutorial.md ==)
* subpages:
* - name: Java
* content: (== include tutorial_java.md ==)
*
* You can reference `Java` page using Markdown reference link syntax:
* `[Java][Tutorial.Java]`.
* @type string $content
* The Markdown content of the page. You can use ```(== include {path}
* ==)``` to include content from a Markdown file. The content can be used
* to produce the documentation page such as HTML format page.
* @type array<\Google\Api\Page>|\Google\Protobuf\Internal\RepeatedField $subpages
* Subpages of this page. The order of subpages specified here will be
* honored in the generated docset.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Documentation::initOnce();
parent::__construct($data);
}
/**
* The name of the page. It will be used as an identity of the page to
* generate URI of the page, text of the link to this page in navigation,
* etc. The full page name (start from the root page name to this page
* concatenated with `.`) can be used as reference to the page in your
* documentation. For example:
* pages:
* - name: Tutorial
* content: (== include tutorial.md ==)
* subpages:
* - name: Java
* content: (== include tutorial_java.md ==)
*
* You can reference `Java` page using Markdown reference link syntax:
* `[Java][Tutorial.Java]`.
*
* Generated from protobuf field string name = 1;
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The name of the page. It will be used as an identity of the page to
* generate URI of the page, text of the link to this page in navigation,
* etc. The full page name (start from the root page name to this page
* concatenated with `.`) can be used as reference to the page in your
* documentation. For example:
* pages:
* - name: Tutorial
* content: (== include tutorial.md ==)
* subpages:
* - name: Java
* content: (== include tutorial_java.md ==)
*
* You can reference `Java` page using Markdown reference link syntax:
* `[Java][Tutorial.Java]`.
*
* Generated from protobuf field string name = 1;
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* The Markdown content of the page. You can use ```(== include {path}
* ==)``` to include content from a Markdown file. The content can be used
* to produce the documentation page such as HTML format page.
*
* Generated from protobuf field string content = 2;
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* The Markdown content of the page. You can use ```(== include {path}
* ==)``` to include content from a Markdown file. The content can be used
* to produce the documentation page such as HTML format page.
*
* Generated from protobuf field string content = 2;
* @param string $var
* @return $this
*/
public function setContent($var)
{
GPBUtil::checkString($var, True);
$this->content = $var;
return $this;
}
/**
* Subpages of this page. The order of subpages specified here will be
* honored in the generated docset.
*
* Generated from protobuf field repeated .google.api.Page subpages = 3;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getSubpages()
{
return $this->subpages;
}
/**
* Subpages of this page. The order of subpages specified here will be
* honored in the generated docset.
*
* Generated from protobuf field repeated .google.api.Page subpages = 3;
* @param array<\Google\Api\Page>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setSubpages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Page::class);
$this->subpages = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/PhpSettings.php
================================================
google.api.PhpSettings
*/
class PhpSettings extends \Google\Protobuf\Internal\Message
{
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
*/
protected $common = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Api\CommonLanguageSettings $common
* Some settings.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @return \Google\Api\CommonLanguageSettings|null
*/
public function getCommon()
{
return $this->common;
}
public function hasCommon()
{
return isset($this->common);
}
public function clearCommon()
{
unset($this->common);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @param \Google\Api\CommonLanguageSettings $var
* @return $this
*/
public function setCommon($var)
{
GPBUtil::checkMessage($var, \Google\Api\CommonLanguageSettings::class);
$this->common = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ProjectProperties.php
================================================
google.api.ProjectProperties
*/
class ProjectProperties extends \Google\Protobuf\Internal\Message
{
/**
* List of per consumer project-specific properties.
*
* Generated from protobuf field repeated .google.api.Property properties = 1;
*/
private $properties;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\Property>|\Google\Protobuf\Internal\RepeatedField $properties
* List of per consumer project-specific properties.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Consumer::initOnce();
parent::__construct($data);
}
/**
* List of per consumer project-specific properties.
*
* Generated from protobuf field repeated .google.api.Property properties = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getProperties()
{
return $this->properties;
}
/**
* List of per consumer project-specific properties.
*
* Generated from protobuf field repeated .google.api.Property properties = 1;
* @param array<\Google\Api\Property>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setProperties($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Property::class);
$this->properties = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Property/PropertyType.php
================================================
google.api.Property.PropertyType
*/
class PropertyType
{
/**
* The type is unspecified, and will result in an error.
*
* Generated from protobuf enum UNSPECIFIED = 0;
*/
const UNSPECIFIED = 0;
/**
* The type is `int64`.
*
* Generated from protobuf enum INT64 = 1;
*/
const INT64 = 1;
/**
* The type is `bool`.
*
* Generated from protobuf enum BOOL = 2;
*/
const BOOL = 2;
/**
* The type is `string`.
*
* Generated from protobuf enum STRING = 3;
*/
const STRING = 3;
/**
* The type is 'double'.
*
* Generated from protobuf enum DOUBLE = 4;
*/
const DOUBLE = 4;
private static $valueToName = [
self::UNSPECIFIED => 'UNSPECIFIED',
self::INT64 => 'INT64',
self::BOOL => 'BOOL',
self::STRING => 'STRING',
self::DOUBLE => 'DOUBLE',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Property.php
================================================
google.api.Property
*/
class Property extends \Google\Protobuf\Internal\Message
{
/**
* The name of the property (a.k.a key).
*
* Generated from protobuf field string name = 1;
*/
protected $name = '';
/**
* The type of this property.
*
* Generated from protobuf field .google.api.Property.PropertyType type = 2;
*/
protected $type = 0;
/**
* The description of the property
*
* Generated from protobuf field string description = 3;
*/
protected $description = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* The name of the property (a.k.a key).
* @type int $type
* The type of this property.
* @type string $description
* The description of the property
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Consumer::initOnce();
parent::__construct($data);
}
/**
* The name of the property (a.k.a key).
*
* Generated from protobuf field string name = 1;
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The name of the property (a.k.a key).
*
* Generated from protobuf field string name = 1;
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* The type of this property.
*
* Generated from protobuf field .google.api.Property.PropertyType type = 2;
* @return int
*/
public function getType()
{
return $this->type;
}
/**
* The type of this property.
*
* Generated from protobuf field .google.api.Property.PropertyType type = 2;
* @param int $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkEnum($var, \Google\Api\Property\PropertyType::class);
$this->type = $var;
return $this;
}
/**
* The description of the property
*
* Generated from protobuf field string description = 3;
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* The description of the property
*
* Generated from protobuf field string description = 3;
* @param string $var
* @return $this
*/
public function setDescription($var)
{
GPBUtil::checkString($var, True);
$this->description = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Publishing.php
================================================
google.api.Publishing
*/
class Publishing extends \Google\Protobuf\Internal\Message
{
/**
* A list of API method settings, e.g. the behavior for methods that use the
* long-running operation pattern.
*
* Generated from protobuf field repeated .google.api.MethodSettings method_settings = 2;
*/
private $method_settings;
/**
* Link to a *public* URI where users can report issues. Example:
* https://issuetracker.google.com/issues/new?component=190865&template=1161103
*
* Generated from protobuf field string new_issue_uri = 101;
*/
protected $new_issue_uri = '';
/**
* Link to product home page. Example:
* https://cloud.google.com/asset-inventory/docs/overview
*
* Generated from protobuf field string documentation_uri = 102;
*/
protected $documentation_uri = '';
/**
* Used as a tracking tag when collecting data about the APIs developer
* relations artifacts like docs, packages delivered to package managers,
* etc. Example: "speech".
*
* Generated from protobuf field string api_short_name = 103;
*/
protected $api_short_name = '';
/**
* GitHub label to apply to issues and pull requests opened for this API.
*
* Generated from protobuf field string github_label = 104;
*/
protected $github_label = '';
/**
* GitHub teams to be added to CODEOWNERS in the directory in GitHub
* containing source code for the client libraries for this API.
*
* Generated from protobuf field repeated string codeowner_github_teams = 105;
*/
private $codeowner_github_teams;
/**
* A prefix used in sample code when demarking regions to be included in
* documentation.
*
* Generated from protobuf field string doc_tag_prefix = 106;
*/
protected $doc_tag_prefix = '';
/**
* For whom the client library is being published.
*
* Generated from protobuf field .google.api.ClientLibraryOrganization organization = 107;
*/
protected $organization = 0;
/**
* Client library settings. If the same version string appears multiple
* times in this list, then the last one wins. Settings from earlier
* settings with the same version string are discarded.
*
* Generated from protobuf field repeated .google.api.ClientLibrarySettings library_settings = 109;
*/
private $library_settings;
/**
* Optional link to proto reference documentation. Example:
* https://cloud.google.com/pubsub/lite/docs/reference/rpc
*
* Generated from protobuf field string proto_reference_documentation_uri = 110;
*/
protected $proto_reference_documentation_uri = '';
/**
* Optional link to REST reference documentation. Example:
* https://cloud.google.com/pubsub/lite/docs/reference/rest
*
* Generated from protobuf field string rest_reference_documentation_uri = 111;
*/
protected $rest_reference_documentation_uri = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\MethodSettings>|\Google\Protobuf\Internal\RepeatedField $method_settings
* A list of API method settings, e.g. the behavior for methods that use the
* long-running operation pattern.
* @type string $new_issue_uri
* Link to a *public* URI where users can report issues. Example:
* https://issuetracker.google.com/issues/new?component=190865&template=1161103
* @type string $documentation_uri
* Link to product home page. Example:
* https://cloud.google.com/asset-inventory/docs/overview
* @type string $api_short_name
* Used as a tracking tag when collecting data about the APIs developer
* relations artifacts like docs, packages delivered to package managers,
* etc. Example: "speech".
* @type string $github_label
* GitHub label to apply to issues and pull requests opened for this API.
* @type array|\Google\Protobuf\Internal\RepeatedField $codeowner_github_teams
* GitHub teams to be added to CODEOWNERS in the directory in GitHub
* containing source code for the client libraries for this API.
* @type string $doc_tag_prefix
* A prefix used in sample code when demarking regions to be included in
* documentation.
* @type int $organization
* For whom the client library is being published.
* @type array<\Google\Api\ClientLibrarySettings>|\Google\Protobuf\Internal\RepeatedField $library_settings
* Client library settings. If the same version string appears multiple
* times in this list, then the last one wins. Settings from earlier
* settings with the same version string are discarded.
* @type string $proto_reference_documentation_uri
* Optional link to proto reference documentation. Example:
* https://cloud.google.com/pubsub/lite/docs/reference/rpc
* @type string $rest_reference_documentation_uri
* Optional link to REST reference documentation. Example:
* https://cloud.google.com/pubsub/lite/docs/reference/rest
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* A list of API method settings, e.g. the behavior for methods that use the
* long-running operation pattern.
*
* Generated from protobuf field repeated .google.api.MethodSettings method_settings = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getMethodSettings()
{
return $this->method_settings;
}
/**
* A list of API method settings, e.g. the behavior for methods that use the
* long-running operation pattern.
*
* Generated from protobuf field repeated .google.api.MethodSettings method_settings = 2;
* @param array<\Google\Api\MethodSettings>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMethodSettings($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MethodSettings::class);
$this->method_settings = $arr;
return $this;
}
/**
* Link to a *public* URI where users can report issues. Example:
* https://issuetracker.google.com/issues/new?component=190865&template=1161103
*
* Generated from protobuf field string new_issue_uri = 101;
* @return string
*/
public function getNewIssueUri()
{
return $this->new_issue_uri;
}
/**
* Link to a *public* URI where users can report issues. Example:
* https://issuetracker.google.com/issues/new?component=190865&template=1161103
*
* Generated from protobuf field string new_issue_uri = 101;
* @param string $var
* @return $this
*/
public function setNewIssueUri($var)
{
GPBUtil::checkString($var, True);
$this->new_issue_uri = $var;
return $this;
}
/**
* Link to product home page. Example:
* https://cloud.google.com/asset-inventory/docs/overview
*
* Generated from protobuf field string documentation_uri = 102;
* @return string
*/
public function getDocumentationUri()
{
return $this->documentation_uri;
}
/**
* Link to product home page. Example:
* https://cloud.google.com/asset-inventory/docs/overview
*
* Generated from protobuf field string documentation_uri = 102;
* @param string $var
* @return $this
*/
public function setDocumentationUri($var)
{
GPBUtil::checkString($var, True);
$this->documentation_uri = $var;
return $this;
}
/**
* Used as a tracking tag when collecting data about the APIs developer
* relations artifacts like docs, packages delivered to package managers,
* etc. Example: "speech".
*
* Generated from protobuf field string api_short_name = 103;
* @return string
*/
public function getApiShortName()
{
return $this->api_short_name;
}
/**
* Used as a tracking tag when collecting data about the APIs developer
* relations artifacts like docs, packages delivered to package managers,
* etc. Example: "speech".
*
* Generated from protobuf field string api_short_name = 103;
* @param string $var
* @return $this
*/
public function setApiShortName($var)
{
GPBUtil::checkString($var, True);
$this->api_short_name = $var;
return $this;
}
/**
* GitHub label to apply to issues and pull requests opened for this API.
*
* Generated from protobuf field string github_label = 104;
* @return string
*/
public function getGithubLabel()
{
return $this->github_label;
}
/**
* GitHub label to apply to issues and pull requests opened for this API.
*
* Generated from protobuf field string github_label = 104;
* @param string $var
* @return $this
*/
public function setGithubLabel($var)
{
GPBUtil::checkString($var, True);
$this->github_label = $var;
return $this;
}
/**
* GitHub teams to be added to CODEOWNERS in the directory in GitHub
* containing source code for the client libraries for this API.
*
* Generated from protobuf field repeated string codeowner_github_teams = 105;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getCodeownerGithubTeams()
{
return $this->codeowner_github_teams;
}
/**
* GitHub teams to be added to CODEOWNERS in the directory in GitHub
* containing source code for the client libraries for this API.
*
* Generated from protobuf field repeated string codeowner_github_teams = 105;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setCodeownerGithubTeams($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->codeowner_github_teams = $arr;
return $this;
}
/**
* A prefix used in sample code when demarking regions to be included in
* documentation.
*
* Generated from protobuf field string doc_tag_prefix = 106;
* @return string
*/
public function getDocTagPrefix()
{
return $this->doc_tag_prefix;
}
/**
* A prefix used in sample code when demarking regions to be included in
* documentation.
*
* Generated from protobuf field string doc_tag_prefix = 106;
* @param string $var
* @return $this
*/
public function setDocTagPrefix($var)
{
GPBUtil::checkString($var, True);
$this->doc_tag_prefix = $var;
return $this;
}
/**
* For whom the client library is being published.
*
* Generated from protobuf field .google.api.ClientLibraryOrganization organization = 107;
* @return int
*/
public function getOrganization()
{
return $this->organization;
}
/**
* For whom the client library is being published.
*
* Generated from protobuf field .google.api.ClientLibraryOrganization organization = 107;
* @param int $var
* @return $this
*/
public function setOrganization($var)
{
GPBUtil::checkEnum($var, \Google\Api\ClientLibraryOrganization::class);
$this->organization = $var;
return $this;
}
/**
* Client library settings. If the same version string appears multiple
* times in this list, then the last one wins. Settings from earlier
* settings with the same version string are discarded.
*
* Generated from protobuf field repeated .google.api.ClientLibrarySettings library_settings = 109;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getLibrarySettings()
{
return $this->library_settings;
}
/**
* Client library settings. If the same version string appears multiple
* times in this list, then the last one wins. Settings from earlier
* settings with the same version string are discarded.
*
* Generated from protobuf field repeated .google.api.ClientLibrarySettings library_settings = 109;
* @param array<\Google\Api\ClientLibrarySettings>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLibrarySettings($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\ClientLibrarySettings::class);
$this->library_settings = $arr;
return $this;
}
/**
* Optional link to proto reference documentation. Example:
* https://cloud.google.com/pubsub/lite/docs/reference/rpc
*
* Generated from protobuf field string proto_reference_documentation_uri = 110;
* @return string
*/
public function getProtoReferenceDocumentationUri()
{
return $this->proto_reference_documentation_uri;
}
/**
* Optional link to proto reference documentation. Example:
* https://cloud.google.com/pubsub/lite/docs/reference/rpc
*
* Generated from protobuf field string proto_reference_documentation_uri = 110;
* @param string $var
* @return $this
*/
public function setProtoReferenceDocumentationUri($var)
{
GPBUtil::checkString($var, True);
$this->proto_reference_documentation_uri = $var;
return $this;
}
/**
* Optional link to REST reference documentation. Example:
* https://cloud.google.com/pubsub/lite/docs/reference/rest
*
* Generated from protobuf field string rest_reference_documentation_uri = 111;
* @return string
*/
public function getRestReferenceDocumentationUri()
{
return $this->rest_reference_documentation_uri;
}
/**
* Optional link to REST reference documentation. Example:
* https://cloud.google.com/pubsub/lite/docs/reference/rest
*
* Generated from protobuf field string rest_reference_documentation_uri = 111;
* @param string $var
* @return $this
*/
public function setRestReferenceDocumentationUri($var)
{
GPBUtil::checkString($var, True);
$this->rest_reference_documentation_uri = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/PythonSettings/ExperimentalFeatures.php
================================================
google.api.PythonSettings.ExperimentalFeatures
*/
class ExperimentalFeatures extends \Google\Protobuf\Internal\Message
{
/**
* Enables generation of asynchronous REST clients if `rest` transport is
* enabled. By default, asynchronous REST clients will not be generated.
* This feature will be enabled by default 1 month after launching the
* feature in preview packages.
*
* Generated from protobuf field bool rest_async_io_enabled = 1;
*/
protected $rest_async_io_enabled = false;
/**
* Enables generation of protobuf code using new types that are more
* Pythonic which are included in `protobuf>=5.29.x`. This feature will be
* enabled by default 1 month after launching the feature in preview
* packages.
*
* Generated from protobuf field bool protobuf_pythonic_types_enabled = 2;
*/
protected $protobuf_pythonic_types_enabled = false;
/**
* Disables generation of an unversioned Python package for this client
* library. This means that the module names will need to be versioned in
* import statements. For example `import google.cloud.library_v2` instead
* of `import google.cloud.library`.
*
* Generated from protobuf field bool unversioned_package_disabled = 3;
*/
protected $unversioned_package_disabled = false;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type bool $rest_async_io_enabled
* Enables generation of asynchronous REST clients if `rest` transport is
* enabled. By default, asynchronous REST clients will not be generated.
* This feature will be enabled by default 1 month after launching the
* feature in preview packages.
* @type bool $protobuf_pythonic_types_enabled
* Enables generation of protobuf code using new types that are more
* Pythonic which are included in `protobuf>=5.29.x`. This feature will be
* enabled by default 1 month after launching the feature in preview
* packages.
* @type bool $unversioned_package_disabled
* Disables generation of an unversioned Python package for this client
* library. This means that the module names will need to be versioned in
* import statements. For example `import google.cloud.library_v2` instead
* of `import google.cloud.library`.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Enables generation of asynchronous REST clients if `rest` transport is
* enabled. By default, asynchronous REST clients will not be generated.
* This feature will be enabled by default 1 month after launching the
* feature in preview packages.
*
* Generated from protobuf field bool rest_async_io_enabled = 1;
* @return bool
*/
public function getRestAsyncIoEnabled()
{
return $this->rest_async_io_enabled;
}
/**
* Enables generation of asynchronous REST clients if `rest` transport is
* enabled. By default, asynchronous REST clients will not be generated.
* This feature will be enabled by default 1 month after launching the
* feature in preview packages.
*
* Generated from protobuf field bool rest_async_io_enabled = 1;
* @param bool $var
* @return $this
*/
public function setRestAsyncIoEnabled($var)
{
GPBUtil::checkBool($var);
$this->rest_async_io_enabled = $var;
return $this;
}
/**
* Enables generation of protobuf code using new types that are more
* Pythonic which are included in `protobuf>=5.29.x`. This feature will be
* enabled by default 1 month after launching the feature in preview
* packages.
*
* Generated from protobuf field bool protobuf_pythonic_types_enabled = 2;
* @return bool
*/
public function getProtobufPythonicTypesEnabled()
{
return $this->protobuf_pythonic_types_enabled;
}
/**
* Enables generation of protobuf code using new types that are more
* Pythonic which are included in `protobuf>=5.29.x`. This feature will be
* enabled by default 1 month after launching the feature in preview
* packages.
*
* Generated from protobuf field bool protobuf_pythonic_types_enabled = 2;
* @param bool $var
* @return $this
*/
public function setProtobufPythonicTypesEnabled($var)
{
GPBUtil::checkBool($var);
$this->protobuf_pythonic_types_enabled = $var;
return $this;
}
/**
* Disables generation of an unversioned Python package for this client
* library. This means that the module names will need to be versioned in
* import statements. For example `import google.cloud.library_v2` instead
* of `import google.cloud.library`.
*
* Generated from protobuf field bool unversioned_package_disabled = 3;
* @return bool
*/
public function getUnversionedPackageDisabled()
{
return $this->unversioned_package_disabled;
}
/**
* Disables generation of an unversioned Python package for this client
* library. This means that the module names will need to be versioned in
* import statements. For example `import google.cloud.library_v2` instead
* of `import google.cloud.library`.
*
* Generated from protobuf field bool unversioned_package_disabled = 3;
* @param bool $var
* @return $this
*/
public function setUnversionedPackageDisabled($var)
{
GPBUtil::checkBool($var);
$this->unversioned_package_disabled = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/PythonSettings.php
================================================
google.api.PythonSettings
*/
class PythonSettings extends \Google\Protobuf\Internal\Message
{
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
*/
protected $common = null;
/**
* Experimental features to be included during client library generation.
*
* Generated from protobuf field .google.api.PythonSettings.ExperimentalFeatures experimental_features = 2;
*/
protected $experimental_features = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Api\CommonLanguageSettings $common
* Some settings.
* @type \Google\Api\PythonSettings\ExperimentalFeatures $experimental_features
* Experimental features to be included during client library generation.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @return \Google\Api\CommonLanguageSettings|null
*/
public function getCommon()
{
return $this->common;
}
public function hasCommon()
{
return isset($this->common);
}
public function clearCommon()
{
unset($this->common);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @param \Google\Api\CommonLanguageSettings $var
* @return $this
*/
public function setCommon($var)
{
GPBUtil::checkMessage($var, \Google\Api\CommonLanguageSettings::class);
$this->common = $var;
return $this;
}
/**
* Experimental features to be included during client library generation.
*
* Generated from protobuf field .google.api.PythonSettings.ExperimentalFeatures experimental_features = 2;
* @return \Google\Api\PythonSettings\ExperimentalFeatures|null
*/
public function getExperimentalFeatures()
{
return $this->experimental_features;
}
public function hasExperimentalFeatures()
{
return isset($this->experimental_features);
}
public function clearExperimentalFeatures()
{
unset($this->experimental_features);
}
/**
* Experimental features to be included during client library generation.
*
* Generated from protobuf field .google.api.PythonSettings.ExperimentalFeatures experimental_features = 2;
* @param \Google\Api\PythonSettings\ExperimentalFeatures $var
* @return $this
*/
public function setExperimentalFeatures($var)
{
GPBUtil::checkMessage($var, \Google\Api\PythonSettings\ExperimentalFeatures::class);
$this->experimental_features = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Quota.php
================================================
google.api.Quota
*/
class Quota extends \Google\Protobuf\Internal\Message
{
/**
* List of QuotaLimit definitions for the service.
*
* Generated from protobuf field repeated .google.api.QuotaLimit limits = 3;
*/
private $limits;
/**
* List of MetricRule definitions, each one mapping a selected method to one
* or more metrics.
*
* Generated from protobuf field repeated .google.api.MetricRule metric_rules = 4;
*/
private $metric_rules;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\QuotaLimit>|\Google\Protobuf\Internal\RepeatedField $limits
* List of QuotaLimit definitions for the service.
* @type array<\Google\Api\MetricRule>|\Google\Protobuf\Internal\RepeatedField $metric_rules
* List of MetricRule definitions, each one mapping a selected method to one
* or more metrics.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Quota::initOnce();
parent::__construct($data);
}
/**
* List of QuotaLimit definitions for the service.
*
* Generated from protobuf field repeated .google.api.QuotaLimit limits = 3;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getLimits()
{
return $this->limits;
}
/**
* List of QuotaLimit definitions for the service.
*
* Generated from protobuf field repeated .google.api.QuotaLimit limits = 3;
* @param array<\Google\Api\QuotaLimit>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLimits($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\QuotaLimit::class);
$this->limits = $arr;
return $this;
}
/**
* List of MetricRule definitions, each one mapping a selected method to one
* or more metrics.
*
* Generated from protobuf field repeated .google.api.MetricRule metric_rules = 4;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getMetricRules()
{
return $this->metric_rules;
}
/**
* List of MetricRule definitions, each one mapping a selected method to one
* or more metrics.
*
* Generated from protobuf field repeated .google.api.MetricRule metric_rules = 4;
* @param array<\Google\Api\MetricRule>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMetricRules($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricRule::class);
$this->metric_rules = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/QuotaLimit.php
================================================
google.api.QuotaLimit
*/
class QuotaLimit extends \Google\Protobuf\Internal\Message
{
/**
* Name of the quota limit.
* The name must be provided, and it must be unique within the service. The
* name can only include alphanumeric characters as well as '-'.
* The maximum length of the limit name is 64 characters.
*
* Generated from protobuf field string name = 6;
*/
protected $name = '';
/**
* Optional. User-visible, extended description for this quota limit.
* Should be used only when more context is needed to understand this limit
* than provided by the limit's display name (see: `display_name`).
*
* Generated from protobuf field string description = 2;
*/
protected $description = '';
/**
* Default number of tokens that can be consumed during the specified
* duration. This is the number of tokens assigned when a client
* application developer activates the service for his/her project.
* Specifying a value of 0 will block all requests. This can be used if you
* are provisioning quota to selected consumers and blocking others.
* Similarly, a value of -1 will indicate an unlimited quota. No other
* negative values are allowed.
* Used by group-based quotas only.
*
* Generated from protobuf field int64 default_limit = 3;
*/
protected $default_limit = 0;
/**
* Maximum number of tokens that can be consumed during the specified
* duration. Client application developers can override the default limit up
* to this maximum. If specified, this value cannot be set to a value less
* than the default limit. If not specified, it is set to the default limit.
* To allow clients to apply overrides with no upper bound, set this to -1,
* indicating unlimited maximum quota.
* Used by group-based quotas only.
*
* Generated from protobuf field int64 max_limit = 4;
*/
protected $max_limit = 0;
/**
* Free tier value displayed in the Developers Console for this limit.
* The free tier is the number of tokens that will be subtracted from the
* billed amount when billing is enabled.
* This field can only be set on a limit with duration "1d", in a billable
* group; it is invalid on any other limit. If this field is not set, it
* defaults to 0, indicating that there is no free tier for this service.
* Used by group-based quotas only.
*
* Generated from protobuf field int64 free_tier = 7;
*/
protected $free_tier = 0;
/**
* Duration of this limit in textual notation. Must be "100s" or "1d".
* Used by group-based quotas only.
*
* Generated from protobuf field string duration = 5;
*/
protected $duration = '';
/**
* The name of the metric this quota limit applies to. The quota limits with
* the same metric will be checked together during runtime. The metric must be
* defined within the service config.
*
* Generated from protobuf field string metric = 8;
*/
protected $metric = '';
/**
* Specify the unit of the quota limit. It uses the same syntax as
* [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
* unit kinds are determined by the quota backend system.
* Here are some examples:
* * "1/min/{project}" for quota per minute per project.
* Note: the order of unit components is insignificant.
* The "1" at the beginning is required to follow the metric unit syntax.
*
* Generated from protobuf field string unit = 9;
*/
protected $unit = '';
/**
* Tiered limit values. You must specify this as a key:value pair, with an
* integer value that is the maximum number of requests allowed for the
* specified unit. Currently only STANDARD is supported.
*
* Generated from protobuf field map values = 10;
*/
private $values;
/**
* User-visible display name for this limit.
* Optional. If not set, the UI will provide a default display name based on
* the quota configuration. This field can be used to override the default
* display name generated from the configuration.
*
* Generated from protobuf field string display_name = 12;
*/
protected $display_name = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* Name of the quota limit.
* The name must be provided, and it must be unique within the service. The
* name can only include alphanumeric characters as well as '-'.
* The maximum length of the limit name is 64 characters.
* @type string $description
* Optional. User-visible, extended description for this quota limit.
* Should be used only when more context is needed to understand this limit
* than provided by the limit's display name (see: `display_name`).
* @type int|string $default_limit
* Default number of tokens that can be consumed during the specified
* duration. This is the number of tokens assigned when a client
* application developer activates the service for his/her project.
* Specifying a value of 0 will block all requests. This can be used if you
* are provisioning quota to selected consumers and blocking others.
* Similarly, a value of -1 will indicate an unlimited quota. No other
* negative values are allowed.
* Used by group-based quotas only.
* @type int|string $max_limit
* Maximum number of tokens that can be consumed during the specified
* duration. Client application developers can override the default limit up
* to this maximum. If specified, this value cannot be set to a value less
* than the default limit. If not specified, it is set to the default limit.
* To allow clients to apply overrides with no upper bound, set this to -1,
* indicating unlimited maximum quota.
* Used by group-based quotas only.
* @type int|string $free_tier
* Free tier value displayed in the Developers Console for this limit.
* The free tier is the number of tokens that will be subtracted from the
* billed amount when billing is enabled.
* This field can only be set on a limit with duration "1d", in a billable
* group; it is invalid on any other limit. If this field is not set, it
* defaults to 0, indicating that there is no free tier for this service.
* Used by group-based quotas only.
* @type string $duration
* Duration of this limit in textual notation. Must be "100s" or "1d".
* Used by group-based quotas only.
* @type string $metric
* The name of the metric this quota limit applies to. The quota limits with
* the same metric will be checked together during runtime. The metric must be
* defined within the service config.
* @type string $unit
* Specify the unit of the quota limit. It uses the same syntax as
* [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
* unit kinds are determined by the quota backend system.
* Here are some examples:
* * "1/min/{project}" for quota per minute per project.
* Note: the order of unit components is insignificant.
* The "1" at the beginning is required to follow the metric unit syntax.
* @type array|\Google\Protobuf\Internal\MapField $values
* Tiered limit values. You must specify this as a key:value pair, with an
* integer value that is the maximum number of requests allowed for the
* specified unit. Currently only STANDARD is supported.
* @type string $display_name
* User-visible display name for this limit.
* Optional. If not set, the UI will provide a default display name based on
* the quota configuration. This field can be used to override the default
* display name generated from the configuration.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Quota::initOnce();
parent::__construct($data);
}
/**
* Name of the quota limit.
* The name must be provided, and it must be unique within the service. The
* name can only include alphanumeric characters as well as '-'.
* The maximum length of the limit name is 64 characters.
*
* Generated from protobuf field string name = 6;
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Name of the quota limit.
* The name must be provided, and it must be unique within the service. The
* name can only include alphanumeric characters as well as '-'.
* The maximum length of the limit name is 64 characters.
*
* Generated from protobuf field string name = 6;
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* Optional. User-visible, extended description for this quota limit.
* Should be used only when more context is needed to understand this limit
* than provided by the limit's display name (see: `display_name`).
*
* Generated from protobuf field string description = 2;
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Optional. User-visible, extended description for this quota limit.
* Should be used only when more context is needed to understand this limit
* than provided by the limit's display name (see: `display_name`).
*
* Generated from protobuf field string description = 2;
* @param string $var
* @return $this
*/
public function setDescription($var)
{
GPBUtil::checkString($var, True);
$this->description = $var;
return $this;
}
/**
* Default number of tokens that can be consumed during the specified
* duration. This is the number of tokens assigned when a client
* application developer activates the service for his/her project.
* Specifying a value of 0 will block all requests. This can be used if you
* are provisioning quota to selected consumers and blocking others.
* Similarly, a value of -1 will indicate an unlimited quota. No other
* negative values are allowed.
* Used by group-based quotas only.
*
* Generated from protobuf field int64 default_limit = 3;
* @return int|string
*/
public function getDefaultLimit()
{
return $this->default_limit;
}
/**
* Default number of tokens that can be consumed during the specified
* duration. This is the number of tokens assigned when a client
* application developer activates the service for his/her project.
* Specifying a value of 0 will block all requests. This can be used if you
* are provisioning quota to selected consumers and blocking others.
* Similarly, a value of -1 will indicate an unlimited quota. No other
* negative values are allowed.
* Used by group-based quotas only.
*
* Generated from protobuf field int64 default_limit = 3;
* @param int|string $var
* @return $this
*/
public function setDefaultLimit($var)
{
GPBUtil::checkInt64($var);
$this->default_limit = $var;
return $this;
}
/**
* Maximum number of tokens that can be consumed during the specified
* duration. Client application developers can override the default limit up
* to this maximum. If specified, this value cannot be set to a value less
* than the default limit. If not specified, it is set to the default limit.
* To allow clients to apply overrides with no upper bound, set this to -1,
* indicating unlimited maximum quota.
* Used by group-based quotas only.
*
* Generated from protobuf field int64 max_limit = 4;
* @return int|string
*/
public function getMaxLimit()
{
return $this->max_limit;
}
/**
* Maximum number of tokens that can be consumed during the specified
* duration. Client application developers can override the default limit up
* to this maximum. If specified, this value cannot be set to a value less
* than the default limit. If not specified, it is set to the default limit.
* To allow clients to apply overrides with no upper bound, set this to -1,
* indicating unlimited maximum quota.
* Used by group-based quotas only.
*
* Generated from protobuf field int64 max_limit = 4;
* @param int|string $var
* @return $this
*/
public function setMaxLimit($var)
{
GPBUtil::checkInt64($var);
$this->max_limit = $var;
return $this;
}
/**
* Free tier value displayed in the Developers Console for this limit.
* The free tier is the number of tokens that will be subtracted from the
* billed amount when billing is enabled.
* This field can only be set on a limit with duration "1d", in a billable
* group; it is invalid on any other limit. If this field is not set, it
* defaults to 0, indicating that there is no free tier for this service.
* Used by group-based quotas only.
*
* Generated from protobuf field int64 free_tier = 7;
* @return int|string
*/
public function getFreeTier()
{
return $this->free_tier;
}
/**
* Free tier value displayed in the Developers Console for this limit.
* The free tier is the number of tokens that will be subtracted from the
* billed amount when billing is enabled.
* This field can only be set on a limit with duration "1d", in a billable
* group; it is invalid on any other limit. If this field is not set, it
* defaults to 0, indicating that there is no free tier for this service.
* Used by group-based quotas only.
*
* Generated from protobuf field int64 free_tier = 7;
* @param int|string $var
* @return $this
*/
public function setFreeTier($var)
{
GPBUtil::checkInt64($var);
$this->free_tier = $var;
return $this;
}
/**
* Duration of this limit in textual notation. Must be "100s" or "1d".
* Used by group-based quotas only.
*
* Generated from protobuf field string duration = 5;
* @return string
*/
public function getDuration()
{
return $this->duration;
}
/**
* Duration of this limit in textual notation. Must be "100s" or "1d".
* Used by group-based quotas only.
*
* Generated from protobuf field string duration = 5;
* @param string $var
* @return $this
*/
public function setDuration($var)
{
GPBUtil::checkString($var, True);
$this->duration = $var;
return $this;
}
/**
* The name of the metric this quota limit applies to. The quota limits with
* the same metric will be checked together during runtime. The metric must be
* defined within the service config.
*
* Generated from protobuf field string metric = 8;
* @return string
*/
public function getMetric()
{
return $this->metric;
}
/**
* The name of the metric this quota limit applies to. The quota limits with
* the same metric will be checked together during runtime. The metric must be
* defined within the service config.
*
* Generated from protobuf field string metric = 8;
* @param string $var
* @return $this
*/
public function setMetric($var)
{
GPBUtil::checkString($var, True);
$this->metric = $var;
return $this;
}
/**
* Specify the unit of the quota limit. It uses the same syntax as
* [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
* unit kinds are determined by the quota backend system.
* Here are some examples:
* * "1/min/{project}" for quota per minute per project.
* Note: the order of unit components is insignificant.
* The "1" at the beginning is required to follow the metric unit syntax.
*
* Generated from protobuf field string unit = 9;
* @return string
*/
public function getUnit()
{
return $this->unit;
}
/**
* Specify the unit of the quota limit. It uses the same syntax as
* [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
* unit kinds are determined by the quota backend system.
* Here are some examples:
* * "1/min/{project}" for quota per minute per project.
* Note: the order of unit components is insignificant.
* The "1" at the beginning is required to follow the metric unit syntax.
*
* Generated from protobuf field string unit = 9;
* @param string $var
* @return $this
*/
public function setUnit($var)
{
GPBUtil::checkString($var, True);
$this->unit = $var;
return $this;
}
/**
* Tiered limit values. You must specify this as a key:value pair, with an
* integer value that is the maximum number of requests allowed for the
* specified unit. Currently only STANDARD is supported.
*
* Generated from protobuf field map values = 10;
* @return \Google\Protobuf\Internal\MapField
*/
public function getValues()
{
return $this->values;
}
/**
* Tiered limit values. You must specify this as a key:value pair, with an
* integer value that is the maximum number of requests allowed for the
* specified unit. Currently only STANDARD is supported.
*
* Generated from protobuf field map values = 10;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setValues($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64);
$this->values = $arr;
return $this;
}
/**
* User-visible display name for this limit.
* Optional. If not set, the UI will provide a default display name based on
* the quota configuration. This field can be used to override the default
* display name generated from the configuration.
*
* Generated from protobuf field string display_name = 12;
* @return string
*/
public function getDisplayName()
{
return $this->display_name;
}
/**
* User-visible display name for this limit.
* Optional. If not set, the UI will provide a default display name based on
* the quota configuration. This field can be used to override the default
* display name generated from the configuration.
*
* Generated from protobuf field string display_name = 12;
* @param string $var
* @return $this
*/
public function setDisplayName($var)
{
GPBUtil::checkString($var, True);
$this->display_name = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ResourceDescriptor/History.php
================================================
google.api.ResourceDescriptor.History
*/
class History
{
/**
* The "unset" value.
*
* Generated from protobuf enum HISTORY_UNSPECIFIED = 0;
*/
const HISTORY_UNSPECIFIED = 0;
/**
* The resource originally had one pattern and launched as such, and
* additional patterns were added later.
*
* Generated from protobuf enum ORIGINALLY_SINGLE_PATTERN = 1;
*/
const ORIGINALLY_SINGLE_PATTERN = 1;
/**
* The resource has one pattern, but the API owner expects to add more
* later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
* that from being necessary once there are multiple patterns.)
*
* Generated from protobuf enum FUTURE_MULTI_PATTERN = 2;
*/
const FUTURE_MULTI_PATTERN = 2;
private static $valueToName = [
self::HISTORY_UNSPECIFIED => 'HISTORY_UNSPECIFIED',
self::ORIGINALLY_SINGLE_PATTERN => 'ORIGINALLY_SINGLE_PATTERN',
self::FUTURE_MULTI_PATTERN => 'FUTURE_MULTI_PATTERN',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ResourceDescriptor/Style.php
================================================
google.api.ResourceDescriptor.Style
*/
class Style
{
/**
* The unspecified value. Do not use.
*
* Generated from protobuf enum STYLE_UNSPECIFIED = 0;
*/
const STYLE_UNSPECIFIED = 0;
/**
* This resource is intended to be "declarative-friendly".
* Declarative-friendly resources must be more strictly consistent, and
* setting this to true communicates to tools that this resource should
* adhere to declarative-friendly expectations.
* Note: This is used by the API linter (linter.aip.dev) to enable
* additional checks.
*
* Generated from protobuf enum DECLARATIVE_FRIENDLY = 1;
*/
const DECLARATIVE_FRIENDLY = 1;
private static $valueToName = [
self::STYLE_UNSPECIFIED => 'STYLE_UNSPECIFIED',
self::DECLARATIVE_FRIENDLY => 'DECLARATIVE_FRIENDLY',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ResourceDescriptor.php
================================================
google.api.ResourceDescriptor
*/
class ResourceDescriptor extends \Google\Protobuf\Internal\Message
{
/**
* The resource type. It must be in the format of
* {service_name}/{resource_type_kind}. The `resource_type_kind` must be
* singular and must not include version numbers.
* Example: `storage.googleapis.com/Bucket`
* The value of the resource_type_kind must follow the regular expression
* /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
* should use PascalCase (UpperCamelCase). The maximum number of
* characters allowed for the `resource_type_kind` is 100.
*
* Generated from protobuf field string type = 1;
*/
protected $type = '';
/**
* Optional. The relative resource name pattern associated with this resource
* type. The DNS prefix of the full resource name shouldn't be specified here.
* The path pattern must follow the syntax, which aligns with HTTP binding
* syntax:
* Template = Segment { "/" Segment } ;
* Segment = LITERAL | Variable ;
* Variable = "{" LITERAL "}" ;
* Examples:
* - "projects/{project}/topics/{topic}"
* - "projects/{project}/knowledgeBases/{knowledge_base}"
* The components in braces correspond to the IDs for each resource in the
* hierarchy. It is expected that, if multiple patterns are provided,
* the same component name (e.g. "project") refers to IDs of the same
* type of resource.
*
* Generated from protobuf field repeated string pattern = 2;
*/
private $pattern;
/**
* Optional. The field on the resource that designates the resource name
* field. If omitted, this is assumed to be "name".
*
* Generated from protobuf field string name_field = 3;
*/
protected $name_field = '';
/**
* Optional. The historical or future-looking state of the resource pattern.
* Example:
* // The InspectTemplate message originally only supported resource
* // names with organization, and project was added later.
* message InspectTemplate {
* option (google.api.resource) = {
* type: "dlp.googleapis.com/InspectTemplate"
* pattern:
* "organizations/{organization}/inspectTemplates/{inspect_template}"
* pattern: "projects/{project}/inspectTemplates/{inspect_template}"
* history: ORIGINALLY_SINGLE_PATTERN
* };
* }
*
* Generated from protobuf field .google.api.ResourceDescriptor.History history = 4;
*/
protected $history = 0;
/**
* The plural name used in the resource name and permission names, such as
* 'projects' for the resource name of 'projects/{project}' and the permission
* name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
* to this is for Nested Collections that have stuttering names, as defined
* in [AIP-122](https://google.aip.dev/122#nested-collections), where the
* collection ID in the resource name pattern does not necessarily directly
* match the `plural` value.
* It is the same concept of the `plural` field in k8s CRD spec
* https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
* Note: The plural form is required even for singleton resources. See
* https://aip.dev/156
*
* Generated from protobuf field string plural = 5;
*/
protected $plural = '';
/**
* The same concept of the `singular` field in k8s CRD spec
* https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
* Such as "project" for the `resourcemanager.googleapis.com/Project` type.
*
* Generated from protobuf field string singular = 6;
*/
protected $singular = '';
/**
* Style flag(s) for this resource.
* These indicate that a resource is expected to conform to a given
* style. See the specific style flags for additional information.
*
* Generated from protobuf field repeated .google.api.ResourceDescriptor.Style style = 10;
*/
private $style;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $type
* The resource type. It must be in the format of
* {service_name}/{resource_type_kind}. The `resource_type_kind` must be
* singular and must not include version numbers.
* Example: `storage.googleapis.com/Bucket`
* The value of the resource_type_kind must follow the regular expression
* /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
* should use PascalCase (UpperCamelCase). The maximum number of
* characters allowed for the `resource_type_kind` is 100.
* @type array|\Google\Protobuf\Internal\RepeatedField $pattern
* Optional. The relative resource name pattern associated with this resource
* type. The DNS prefix of the full resource name shouldn't be specified here.
* The path pattern must follow the syntax, which aligns with HTTP binding
* syntax:
* Template = Segment { "/" Segment } ;
* Segment = LITERAL | Variable ;
* Variable = "{" LITERAL "}" ;
* Examples:
* - "projects/{project}/topics/{topic}"
* - "projects/{project}/knowledgeBases/{knowledge_base}"
* The components in braces correspond to the IDs for each resource in the
* hierarchy. It is expected that, if multiple patterns are provided,
* the same component name (e.g. "project") refers to IDs of the same
* type of resource.
* @type string $name_field
* Optional. The field on the resource that designates the resource name
* field. If omitted, this is assumed to be "name".
* @type int $history
* Optional. The historical or future-looking state of the resource pattern.
* Example:
* // The InspectTemplate message originally only supported resource
* // names with organization, and project was added later.
* message InspectTemplate {
* option (google.api.resource) = {
* type: "dlp.googleapis.com/InspectTemplate"
* pattern:
* "organizations/{organization}/inspectTemplates/{inspect_template}"
* pattern: "projects/{project}/inspectTemplates/{inspect_template}"
* history: ORIGINALLY_SINGLE_PATTERN
* };
* }
* @type string $plural
* The plural name used in the resource name and permission names, such as
* 'projects' for the resource name of 'projects/{project}' and the permission
* name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
* to this is for Nested Collections that have stuttering names, as defined
* in [AIP-122](https://google.aip.dev/122#nested-collections), where the
* collection ID in the resource name pattern does not necessarily directly
* match the `plural` value.
* It is the same concept of the `plural` field in k8s CRD spec
* https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
* Note: The plural form is required even for singleton resources. See
* https://aip.dev/156
* @type string $singular
* The same concept of the `singular` field in k8s CRD spec
* https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
* Such as "project" for the `resourcemanager.googleapis.com/Project` type.
* @type array|\Google\Protobuf\Internal\RepeatedField $style
* Style flag(s) for this resource.
* These indicate that a resource is expected to conform to a given
* style. See the specific style flags for additional information.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Resource::initOnce();
parent::__construct($data);
}
/**
* The resource type. It must be in the format of
* {service_name}/{resource_type_kind}. The `resource_type_kind` must be
* singular and must not include version numbers.
* Example: `storage.googleapis.com/Bucket`
* The value of the resource_type_kind must follow the regular expression
* /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
* should use PascalCase (UpperCamelCase). The maximum number of
* characters allowed for the `resource_type_kind` is 100.
*
* Generated from protobuf field string type = 1;
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* The resource type. It must be in the format of
* {service_name}/{resource_type_kind}. The `resource_type_kind` must be
* singular and must not include version numbers.
* Example: `storage.googleapis.com/Bucket`
* The value of the resource_type_kind must follow the regular expression
* /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
* should use PascalCase (UpperCamelCase). The maximum number of
* characters allowed for the `resource_type_kind` is 100.
*
* Generated from protobuf field string type = 1;
* @param string $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkString($var, True);
$this->type = $var;
return $this;
}
/**
* Optional. The relative resource name pattern associated with this resource
* type. The DNS prefix of the full resource name shouldn't be specified here.
* The path pattern must follow the syntax, which aligns with HTTP binding
* syntax:
* Template = Segment { "/" Segment } ;
* Segment = LITERAL | Variable ;
* Variable = "{" LITERAL "}" ;
* Examples:
* - "projects/{project}/topics/{topic}"
* - "projects/{project}/knowledgeBases/{knowledge_base}"
* The components in braces correspond to the IDs for each resource in the
* hierarchy. It is expected that, if multiple patterns are provided,
* the same component name (e.g. "project") refers to IDs of the same
* type of resource.
*
* Generated from protobuf field repeated string pattern = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getPattern()
{
return $this->pattern;
}
/**
* Optional. The relative resource name pattern associated with this resource
* type. The DNS prefix of the full resource name shouldn't be specified here.
* The path pattern must follow the syntax, which aligns with HTTP binding
* syntax:
* Template = Segment { "/" Segment } ;
* Segment = LITERAL | Variable ;
* Variable = "{" LITERAL "}" ;
* Examples:
* - "projects/{project}/topics/{topic}"
* - "projects/{project}/knowledgeBases/{knowledge_base}"
* The components in braces correspond to the IDs for each resource in the
* hierarchy. It is expected that, if multiple patterns are provided,
* the same component name (e.g. "project") refers to IDs of the same
* type of resource.
*
* Generated from protobuf field repeated string pattern = 2;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setPattern($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->pattern = $arr;
return $this;
}
/**
* Optional. The field on the resource that designates the resource name
* field. If omitted, this is assumed to be "name".
*
* Generated from protobuf field string name_field = 3;
* @return string
*/
public function getNameField()
{
return $this->name_field;
}
/**
* Optional. The field on the resource that designates the resource name
* field. If omitted, this is assumed to be "name".
*
* Generated from protobuf field string name_field = 3;
* @param string $var
* @return $this
*/
public function setNameField($var)
{
GPBUtil::checkString($var, True);
$this->name_field = $var;
return $this;
}
/**
* Optional. The historical or future-looking state of the resource pattern.
* Example:
* // The InspectTemplate message originally only supported resource
* // names with organization, and project was added later.
* message InspectTemplate {
* option (google.api.resource) = {
* type: "dlp.googleapis.com/InspectTemplate"
* pattern:
* "organizations/{organization}/inspectTemplates/{inspect_template}"
* pattern: "projects/{project}/inspectTemplates/{inspect_template}"
* history: ORIGINALLY_SINGLE_PATTERN
* };
* }
*
* Generated from protobuf field .google.api.ResourceDescriptor.History history = 4;
* @return int
*/
public function getHistory()
{
return $this->history;
}
/**
* Optional. The historical or future-looking state of the resource pattern.
* Example:
* // The InspectTemplate message originally only supported resource
* // names with organization, and project was added later.
* message InspectTemplate {
* option (google.api.resource) = {
* type: "dlp.googleapis.com/InspectTemplate"
* pattern:
* "organizations/{organization}/inspectTemplates/{inspect_template}"
* pattern: "projects/{project}/inspectTemplates/{inspect_template}"
* history: ORIGINALLY_SINGLE_PATTERN
* };
* }
*
* Generated from protobuf field .google.api.ResourceDescriptor.History history = 4;
* @param int $var
* @return $this
*/
public function setHistory($var)
{
GPBUtil::checkEnum($var, \Google\Api\ResourceDescriptor\History::class);
$this->history = $var;
return $this;
}
/**
* The plural name used in the resource name and permission names, such as
* 'projects' for the resource name of 'projects/{project}' and the permission
* name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
* to this is for Nested Collections that have stuttering names, as defined
* in [AIP-122](https://google.aip.dev/122#nested-collections), where the
* collection ID in the resource name pattern does not necessarily directly
* match the `plural` value.
* It is the same concept of the `plural` field in k8s CRD spec
* https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
* Note: The plural form is required even for singleton resources. See
* https://aip.dev/156
*
* Generated from protobuf field string plural = 5;
* @return string
*/
public function getPlural()
{
return $this->plural;
}
/**
* The plural name used in the resource name and permission names, such as
* 'projects' for the resource name of 'projects/{project}' and the permission
* name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
* to this is for Nested Collections that have stuttering names, as defined
* in [AIP-122](https://google.aip.dev/122#nested-collections), where the
* collection ID in the resource name pattern does not necessarily directly
* match the `plural` value.
* It is the same concept of the `plural` field in k8s CRD spec
* https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
* Note: The plural form is required even for singleton resources. See
* https://aip.dev/156
*
* Generated from protobuf field string plural = 5;
* @param string $var
* @return $this
*/
public function setPlural($var)
{
GPBUtil::checkString($var, True);
$this->plural = $var;
return $this;
}
/**
* The same concept of the `singular` field in k8s CRD spec
* https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
* Such as "project" for the `resourcemanager.googleapis.com/Project` type.
*
* Generated from protobuf field string singular = 6;
* @return string
*/
public function getSingular()
{
return $this->singular;
}
/**
* The same concept of the `singular` field in k8s CRD spec
* https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
* Such as "project" for the `resourcemanager.googleapis.com/Project` type.
*
* Generated from protobuf field string singular = 6;
* @param string $var
* @return $this
*/
public function setSingular($var)
{
GPBUtil::checkString($var, True);
$this->singular = $var;
return $this;
}
/**
* Style flag(s) for this resource.
* These indicate that a resource is expected to conform to a given
* style. See the specific style flags for additional information.
*
* Generated from protobuf field repeated .google.api.ResourceDescriptor.Style style = 10;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getStyle()
{
return $this->style;
}
/**
* Style flag(s) for this resource.
* These indicate that a resource is expected to conform to a given
* style. See the specific style flags for additional information.
*
* Generated from protobuf field repeated .google.api.ResourceDescriptor.Style style = 10;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setStyle($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Api\ResourceDescriptor\Style::class);
$this->style = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/ResourceReference.php
================================================
google.api.ResourceReference
*/
class ResourceReference extends \Google\Protobuf\Internal\Message
{
/**
* The resource type that the annotated field references.
* Example:
* message Subscription {
* string topic = 2 [(google.api.resource_reference) = {
* type: "pubsub.googleapis.com/Topic"
* }];
* }
* Occasionally, a field may reference an arbitrary resource. In this case,
* APIs use the special value * in their resource reference.
* Example:
* message GetIamPolicyRequest {
* string resource = 2 [(google.api.resource_reference) = {
* type: "*"
* }];
* }
*
* Generated from protobuf field string type = 1;
*/
protected $type = '';
/**
* The resource type of a child collection that the annotated field
* references. This is useful for annotating the `parent` field that
* doesn't have a fixed resource type.
* Example:
* message ListLogEntriesRequest {
* string parent = 1 [(google.api.resource_reference) = {
* child_type: "logging.googleapis.com/LogEntry"
* };
* }
*
* Generated from protobuf field string child_type = 2;
*/
protected $child_type = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $type
* The resource type that the annotated field references.
* Example:
* message Subscription {
* string topic = 2 [(google.api.resource_reference) = {
* type: "pubsub.googleapis.com/Topic"
* }];
* }
* Occasionally, a field may reference an arbitrary resource. In this case,
* APIs use the special value * in their resource reference.
* Example:
* message GetIamPolicyRequest {
* string resource = 2 [(google.api.resource_reference) = {
* type: "*"
* }];
* }
* @type string $child_type
* The resource type of a child collection that the annotated field
* references. This is useful for annotating the `parent` field that
* doesn't have a fixed resource type.
* Example:
* message ListLogEntriesRequest {
* string parent = 1 [(google.api.resource_reference) = {
* child_type: "logging.googleapis.com/LogEntry"
* };
* }
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Resource::initOnce();
parent::__construct($data);
}
/**
* The resource type that the annotated field references.
* Example:
* message Subscription {
* string topic = 2 [(google.api.resource_reference) = {
* type: "pubsub.googleapis.com/Topic"
* }];
* }
* Occasionally, a field may reference an arbitrary resource. In this case,
* APIs use the special value * in their resource reference.
* Example:
* message GetIamPolicyRequest {
* string resource = 2 [(google.api.resource_reference) = {
* type: "*"
* }];
* }
*
* Generated from protobuf field string type = 1;
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* The resource type that the annotated field references.
* Example:
* message Subscription {
* string topic = 2 [(google.api.resource_reference) = {
* type: "pubsub.googleapis.com/Topic"
* }];
* }
* Occasionally, a field may reference an arbitrary resource. In this case,
* APIs use the special value * in their resource reference.
* Example:
* message GetIamPolicyRequest {
* string resource = 2 [(google.api.resource_reference) = {
* type: "*"
* }];
* }
*
* Generated from protobuf field string type = 1;
* @param string $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkString($var, True);
$this->type = $var;
return $this;
}
/**
* The resource type of a child collection that the annotated field
* references. This is useful for annotating the `parent` field that
* doesn't have a fixed resource type.
* Example:
* message ListLogEntriesRequest {
* string parent = 1 [(google.api.resource_reference) = {
* child_type: "logging.googleapis.com/LogEntry"
* };
* }
*
* Generated from protobuf field string child_type = 2;
* @return string
*/
public function getChildType()
{
return $this->child_type;
}
/**
* The resource type of a child collection that the annotated field
* references. This is useful for annotating the `parent` field that
* doesn't have a fixed resource type.
* Example:
* message ListLogEntriesRequest {
* string parent = 1 [(google.api.resource_reference) = {
* child_type: "logging.googleapis.com/LogEntry"
* };
* }
*
* Generated from protobuf field string child_type = 2;
* @param string $var
* @return $this
*/
public function setChildType($var)
{
GPBUtil::checkString($var, True);
$this->child_type = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/RoutingParameter.php
================================================
google.api.RoutingParameter
*/
class RoutingParameter extends \Google\Protobuf\Internal\Message
{
/**
* A request field to extract the header key-value pair from.
*
* Generated from protobuf field string field = 1;
*/
protected $field = '';
/**
* A pattern matching the key-value field. Optional.
* If not specified, the whole field specified in the `field` field will be
* taken as value, and its name used as key. If specified, it MUST contain
* exactly one named segment (along with any number of unnamed segments) The
* pattern will be matched over the field specified in the `field` field, then
* if the match is successful:
* - the name of the single named segment will be used as a header name,
* - the match value of the segment will be used as a header value;
* if the match is NOT successful, nothing will be sent.
* Example:
* -- This is a field in the request message
* | that the header value will be extracted from.
* |
* | -- This is the key name in the
* | | routing header.
* V |
* field: "table_name" v
* path_template: "projects/*/{table_location=instances/*}/tables/*"
* ^ ^
* | |
* In the {} brackets is the pattern that -- |
* specifies what to extract from the |
* field as a value to be sent. |
* |
* The string in the field must match the whole pattern --
* before brackets, inside brackets, after brackets.
* When looking at this specific example, we can see that:
* - A key-value pair with the key `table_location`
* and the value matching `instances/*` should be added
* to the x-goog-request-params routing header.
* - The value is extracted from the request message's `table_name` field
* if it matches the full pattern specified:
* `projects/*/instances/*/tables/*`.
* **NB:** If the `path_template` field is not provided, the key name is
* equal to the field name, and the whole field should be sent as a value.
* This makes the pattern for the field and the value functionally equivalent
* to `**`, and the configuration
* {
* field: "table_name"
* }
* is a functionally equivalent shorthand to:
* {
* field: "table_name"
* path_template: "{table_name=**}"
* }
* See Example 1 for more details.
*
* Generated from protobuf field string path_template = 2;
*/
protected $path_template = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $field
* A request field to extract the header key-value pair from.
* @type string $path_template
* A pattern matching the key-value field. Optional.
* If not specified, the whole field specified in the `field` field will be
* taken as value, and its name used as key. If specified, it MUST contain
* exactly one named segment (along with any number of unnamed segments) The
* pattern will be matched over the field specified in the `field` field, then
* if the match is successful:
* - the name of the single named segment will be used as a header name,
* - the match value of the segment will be used as a header value;
* if the match is NOT successful, nothing will be sent.
* Example:
* -- This is a field in the request message
* | that the header value will be extracted from.
* |
* | -- This is the key name in the
* | | routing header.
* V |
* field: "table_name" v
* path_template: "projects/*/{table_location=instances/*}/tables/*"
* ^ ^
* | |
* In the {} brackets is the pattern that -- |
* specifies what to extract from the |
* field as a value to be sent. |
* |
* The string in the field must match the whole pattern --
* before brackets, inside brackets, after brackets.
* When looking at this specific example, we can see that:
* - A key-value pair with the key `table_location`
* and the value matching `instances/*` should be added
* to the x-goog-request-params routing header.
* - The value is extracted from the request message's `table_name` field
* if it matches the full pattern specified:
* `projects/*/instances/*/tables/*`.
* **NB:** If the `path_template` field is not provided, the key name is
* equal to the field name, and the whole field should be sent as a value.
* This makes the pattern for the field and the value functionally equivalent
* to `**`, and the configuration
* {
* field: "table_name"
* }
* is a functionally equivalent shorthand to:
* {
* field: "table_name"
* path_template: "{table_name=**}"
* }
* See Example 1 for more details.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Routing::initOnce();
parent::__construct($data);
}
/**
* A request field to extract the header key-value pair from.
*
* Generated from protobuf field string field = 1;
* @return string
*/
public function getField()
{
return $this->field;
}
/**
* A request field to extract the header key-value pair from.
*
* Generated from protobuf field string field = 1;
* @param string $var
* @return $this
*/
public function setField($var)
{
GPBUtil::checkString($var, True);
$this->field = $var;
return $this;
}
/**
* A pattern matching the key-value field. Optional.
* If not specified, the whole field specified in the `field` field will be
* taken as value, and its name used as key. If specified, it MUST contain
* exactly one named segment (along with any number of unnamed segments) The
* pattern will be matched over the field specified in the `field` field, then
* if the match is successful:
* - the name of the single named segment will be used as a header name,
* - the match value of the segment will be used as a header value;
* if the match is NOT successful, nothing will be sent.
* Example:
* -- This is a field in the request message
* | that the header value will be extracted from.
* |
* | -- This is the key name in the
* | | routing header.
* V |
* field: "table_name" v
* path_template: "projects/*/{table_location=instances/*}/tables/*"
* ^ ^
* | |
* In the {} brackets is the pattern that -- |
* specifies what to extract from the |
* field as a value to be sent. |
* |
* The string in the field must match the whole pattern --
* before brackets, inside brackets, after brackets.
* When looking at this specific example, we can see that:
* - A key-value pair with the key `table_location`
* and the value matching `instances/*` should be added
* to the x-goog-request-params routing header.
* - The value is extracted from the request message's `table_name` field
* if it matches the full pattern specified:
* `projects/*/instances/*/tables/*`.
* **NB:** If the `path_template` field is not provided, the key name is
* equal to the field name, and the whole field should be sent as a value.
* This makes the pattern for the field and the value functionally equivalent
* to `**`, and the configuration
* {
* field: "table_name"
* }
* is a functionally equivalent shorthand to:
* {
* field: "table_name"
* path_template: "{table_name=**}"
* }
* See Example 1 for more details.
*
* Generated from protobuf field string path_template = 2;
* @return string
*/
public function getPathTemplate()
{
return $this->path_template;
}
/**
* A pattern matching the key-value field. Optional.
* If not specified, the whole field specified in the `field` field will be
* taken as value, and its name used as key. If specified, it MUST contain
* exactly one named segment (along with any number of unnamed segments) The
* pattern will be matched over the field specified in the `field` field, then
* if the match is successful:
* - the name of the single named segment will be used as a header name,
* - the match value of the segment will be used as a header value;
* if the match is NOT successful, nothing will be sent.
* Example:
* -- This is a field in the request message
* | that the header value will be extracted from.
* |
* | -- This is the key name in the
* | | routing header.
* V |
* field: "table_name" v
* path_template: "projects/*/{table_location=instances/*}/tables/*"
* ^ ^
* | |
* In the {} brackets is the pattern that -- |
* specifies what to extract from the |
* field as a value to be sent. |
* |
* The string in the field must match the whole pattern --
* before brackets, inside brackets, after brackets.
* When looking at this specific example, we can see that:
* - A key-value pair with the key `table_location`
* and the value matching `instances/*` should be added
* to the x-goog-request-params routing header.
* - The value is extracted from the request message's `table_name` field
* if it matches the full pattern specified:
* `projects/*/instances/*/tables/*`.
* **NB:** If the `path_template` field is not provided, the key name is
* equal to the field name, and the whole field should be sent as a value.
* This makes the pattern for the field and the value functionally equivalent
* to `**`, and the configuration
* {
* field: "table_name"
* }
* is a functionally equivalent shorthand to:
* {
* field: "table_name"
* path_template: "{table_name=**}"
* }
* See Example 1 for more details.
*
* Generated from protobuf field string path_template = 2;
* @param string $var
* @return $this
*/
public function setPathTemplate($var)
{
GPBUtil::checkString($var, True);
$this->path_template = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/RoutingRule.php
================================================
/tables/`
* // - `projects//instances//tables/`
* // - `region//zones//tables/`
* string table_name = 1;
* // This value specifies routing for replication.
* // It can be in the following formats:
* // - `profiles/`
* // - a legacy `profile_id` that can be any string
* string app_profile_id = 2;
* }
* Example message:
* {
* table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
* app_profile_id: profiles/prof_qux
* }
* The routing header consists of one or multiple key-value pairs. Every key
* and value must be percent-encoded, and joined together in the format of
* `key1=value1&key2=value2`.
* The examples below skip the percent-encoding for readability.
* Example 1
* Extracting a field from the request to put into the routing header
* unchanged, with the key equal to the field name.
* annotation:
* option (google.api.routing) = {
* // Take the `app_profile_id`.
* routing_parameters {
* field: "app_profile_id"
* }
* };
* result:
* x-goog-request-params: app_profile_id=profiles/prof_qux
* Example 2
* Extracting a field from the request to put into the routing header
* unchanged, with the key different from the field name.
* annotation:
* option (google.api.routing) = {
* // Take the `app_profile_id`, but name it `routing_id` in the header.
* routing_parameters {
* field: "app_profile_id"
* path_template: "{routing_id=**}"
* }
* };
* result:
* x-goog-request-params: routing_id=profiles/prof_qux
* Example 3
* Extracting a field from the request to put into the routing
* header, while matching a path template syntax on the field's value.
* NB: it is more useful to send nothing than to send garbage for the purpose
* of dynamic routing, since garbage pollutes cache. Thus the matching.
* Sub-example 3a
* The field matches the template.
* annotation:
* option (google.api.routing) = {
* // Take the `table_name`, if it's well-formed (with project-based
* // syntax).
* routing_parameters {
* field: "table_name"
* path_template: "{table_name=projects/*/instances/*/**}"
* }
* };
* result:
* x-goog-request-params:
* table_name=projects/proj_foo/instances/instance_bar/table/table_baz
* Sub-example 3b
* The field does not match the template.
* annotation:
* option (google.api.routing) = {
* // Take the `table_name`, if it's well-formed (with region-based
* // syntax).
* routing_parameters {
* field: "table_name"
* path_template: "{table_name=regions/*/zones/*/**}"
* }
* };
* result:
*
* Sub-example 3c
* Multiple alternative conflictingly named path templates are
* specified. The one that matches is used to construct the header.
* annotation:
* option (google.api.routing) = {
* // Take the `table_name`, if it's well-formed, whether
* // using the region- or projects-based syntax.
* routing_parameters {
* field: "table_name"
* path_template: "{table_name=regions/*/zones/*/**}"
* }
* routing_parameters {
* field: "table_name"
* path_template: "{table_name=projects/*/instances/*/**}"
* }
* };
* result:
* x-goog-request-params:
* table_name=projects/proj_foo/instances/instance_bar/table/table_baz
* Example 4
* Extracting a single routing header key-value pair by matching a
* template syntax on (a part of) a single request field.
* annotation:
* option (google.api.routing) = {
* // Take just the project id from the `table_name` field.
* routing_parameters {
* field: "table_name"
* path_template: "{routing_id=projects/*}/**"
* }
* };
* result:
* x-goog-request-params: routing_id=projects/proj_foo
* Example 5
* Extracting a single routing header key-value pair by matching
* several conflictingly named path templates on (parts of) a single request
* field. The last template to match "wins" the conflict.
* annotation:
* option (google.api.routing) = {
* // If the `table_name` does not have instances information,
* // take just the project id for routing.
* // Otherwise take project + instance.
* routing_parameters {
* field: "table_name"
* path_template: "{routing_id=projects/*}/**"
* }
* routing_parameters {
* field: "table_name"
* path_template: "{routing_id=projects/*/instances/*}/**"
* }
* };
* result:
* x-goog-request-params:
* routing_id=projects/proj_foo/instances/instance_bar
* Example 6
* Extracting multiple routing header key-value pairs by matching
* several non-conflicting path templates on (parts of) a single request field.
* Sub-example 6a
* Make the templates strict, so that if the `table_name` does not
* have an instance information, nothing is sent.
* annotation:
* option (google.api.routing) = {
* // The routing code needs two keys instead of one composite
* // but works only for the tables with the "project-instance" name
* // syntax.
* routing_parameters {
* field: "table_name"
* path_template: "{project_id=projects/*}/instances/*/**"
* }
* routing_parameters {
* field: "table_name"
* path_template: "projects/*/{instance_id=instances/*}/**"
* }
* };
* result:
* x-goog-request-params:
* project_id=projects/proj_foo&instance_id=instances/instance_bar
* Sub-example 6b
* Make the templates loose, so that if the `table_name` does not
* have an instance information, just the project id part is sent.
* annotation:
* option (google.api.routing) = {
* // The routing code wants two keys instead of one composite
* // but will work with just the `project_id` for tables without
* // an instance in the `table_name`.
* routing_parameters {
* field: "table_name"
* path_template: "{project_id=projects/*}/**"
* }
* routing_parameters {
* field: "table_name"
* path_template: "projects/*/{instance_id=instances/*}/**"
* }
* };
* result (is the same as 6a for our example message because it has the instance
* information):
* x-goog-request-params:
* project_id=projects/proj_foo&instance_id=instances/instance_bar
* Example 7
* Extracting multiple routing header key-value pairs by matching
* several path templates on multiple request fields.
* NB: note that here there is no way to specify sending nothing if one of the
* fields does not match its template. E.g. if the `table_name` is in the wrong
* format, the `project_id` will not be sent, but the `routing_id` will be.
* The backend routing code has to be aware of that and be prepared to not
* receive a full complement of keys if it expects multiple.
* annotation:
* option (google.api.routing) = {
* // The routing needs both `project_id` and `routing_id`
* // (from the `app_profile_id` field) for routing.
* routing_parameters {
* field: "table_name"
* path_template: "{project_id=projects/*}/**"
* }
* routing_parameters {
* field: "app_profile_id"
* path_template: "{routing_id=**}"
* }
* };
* result:
* x-goog-request-params:
* project_id=projects/proj_foo&routing_id=profiles/prof_qux
* Example 8
* Extracting a single routing header key-value pair by matching
* several conflictingly named path templates on several request fields. The
* last template to match "wins" the conflict.
* annotation:
* option (google.api.routing) = {
* // The `routing_id` can be a project id or a region id depending on
* // the table name format, but only if the `app_profile_id` is not set.
* // If `app_profile_id` is set it should be used instead.
* routing_parameters {
* field: "table_name"
* path_template: "{routing_id=projects/*}/**"
* }
* routing_parameters {
* field: "table_name"
* path_template: "{routing_id=regions/*}/**"
* }
* routing_parameters {
* field: "app_profile_id"
* path_template: "{routing_id=**}"
* }
* };
* result:
* x-goog-request-params: routing_id=profiles/prof_qux
* Example 9
* Bringing it all together.
* annotation:
* option (google.api.routing) = {
* // For routing both `table_location` and a `routing_id` are needed.
* //
* // table_location can be either an instance id or a region+zone id.
* //
* // For `routing_id`, take the value of `app_profile_id`
* // - If it's in the format `profiles/`, send
* // just the `` part.
* // - If it's any other literal, send it as is.
* // If the `app_profile_id` is empty, and the `table_name` starts with
* // the project_id, send that instead.
* routing_parameters {
* field: "table_name"
* path_template: "projects/*/{table_location=instances/*}/tables/*"
* }
* routing_parameters {
* field: "table_name"
* path_template: "{table_location=regions/*/zones/*}/tables/*"
* }
* routing_parameters {
* field: "table_name"
* path_template: "{routing_id=projects/*}/**"
* }
* routing_parameters {
* field: "app_profile_id"
* path_template: "{routing_id=**}"
* }
* routing_parameters {
* field: "app_profile_id"
* path_template: "profiles/{routing_id=*}"
* }
* };
* result:
* x-goog-request-params:
* table_location=instances/instance_bar&routing_id=prof_qux
*
* Generated from protobuf message google.api.RoutingRule
*/
class RoutingRule extends \Google\Protobuf\Internal\Message
{
/**
* A collection of Routing Parameter specifications.
* **NOTE:** If multiple Routing Parameters describe the same key
* (via the `path_template` field or via the `field` field when
* `path_template` is not provided), "last one wins" rule
* determines which Parameter gets used.
* See the examples for more details.
*
* Generated from protobuf field repeated .google.api.RoutingParameter routing_parameters = 2;
*/
private $routing_parameters;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\RoutingParameter>|\Google\Protobuf\Internal\RepeatedField $routing_parameters
* A collection of Routing Parameter specifications.
* **NOTE:** If multiple Routing Parameters describe the same key
* (via the `path_template` field or via the `field` field when
* `path_template` is not provided), "last one wins" rule
* determines which Parameter gets used.
* See the examples for more details.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Routing::initOnce();
parent::__construct($data);
}
/**
* A collection of Routing Parameter specifications.
* **NOTE:** If multiple Routing Parameters describe the same key
* (via the `path_template` field or via the `field` field when
* `path_template` is not provided), "last one wins" rule
* determines which Parameter gets used.
* See the examples for more details.
*
* Generated from protobuf field repeated .google.api.RoutingParameter routing_parameters = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getRoutingParameters()
{
return $this->routing_parameters;
}
/**
* A collection of Routing Parameter specifications.
* **NOTE:** If multiple Routing Parameters describe the same key
* (via the `path_template` field or via the `field` field when
* `path_template` is not provided), "last one wins" rule
* determines which Parameter gets used.
* See the examples for more details.
*
* Generated from protobuf field repeated .google.api.RoutingParameter routing_parameters = 2;
* @param array<\Google\Api\RoutingParameter>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setRoutingParameters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\RoutingParameter::class);
$this->routing_parameters = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/RubySettings.php
================================================
google.api.RubySettings
*/
class RubySettings extends \Google\Protobuf\Internal\Message
{
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
*/
protected $common = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Api\CommonLanguageSettings $common
* Some settings.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @return \Google\Api\CommonLanguageSettings|null
*/
public function getCommon()
{
return $this->common;
}
public function hasCommon()
{
return isset($this->common);
}
public function clearCommon()
{
unset($this->common);
}
/**
* Some settings.
*
* Generated from protobuf field .google.api.CommonLanguageSettings common = 1;
* @param \Google\Api\CommonLanguageSettings $var
* @return $this
*/
public function setCommon($var)
{
GPBUtil::checkMessage($var, \Google\Api\CommonLanguageSettings::class);
$this->common = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/SelectiveGapicGeneration.php
================================================
google.api.SelectiveGapicGeneration
*/
class SelectiveGapicGeneration extends \Google\Protobuf\Internal\Message
{
/**
* An allowlist of the fully qualified names of RPCs that should be included
* on public client surfaces.
*
* Generated from protobuf field repeated string methods = 1;
*/
private $methods;
/**
* Setting this to true indicates to the client generators that methods
* that would be excluded from the generation should instead be generated
* in a way that indicates these methods should not be consumed by
* end users. How this is expressed is up to individual language
* implementations to decide. Some examples may be: added annotations,
* obfuscated identifiers, or other language idiomatic patterns.
*
* Generated from protobuf field bool generate_omitted_as_internal = 2;
*/
protected $generate_omitted_as_internal = false;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array|\Google\Protobuf\Internal\RepeatedField $methods
* An allowlist of the fully qualified names of RPCs that should be included
* on public client surfaces.
* @type bool $generate_omitted_as_internal
* Setting this to true indicates to the client generators that methods
* that would be excluded from the generation should instead be generated
* in a way that indicates these methods should not be consumed by
* end users. How this is expressed is up to individual language
* implementations to decide. Some examples may be: added annotations,
* obfuscated identifiers, or other language idiomatic patterns.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Client::initOnce();
parent::__construct($data);
}
/**
* An allowlist of the fully qualified names of RPCs that should be included
* on public client surfaces.
*
* Generated from protobuf field repeated string methods = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getMethods()
{
return $this->methods;
}
/**
* An allowlist of the fully qualified names of RPCs that should be included
* on public client surfaces.
*
* Generated from protobuf field repeated string methods = 1;
* @param array|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMethods($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->methods = $arr;
return $this;
}
/**
* Setting this to true indicates to the client generators that methods
* that would be excluded from the generation should instead be generated
* in a way that indicates these methods should not be consumed by
* end users. How this is expressed is up to individual language
* implementations to decide. Some examples may be: added annotations,
* obfuscated identifiers, or other language idiomatic patterns.
*
* Generated from protobuf field bool generate_omitted_as_internal = 2;
* @return bool
*/
public function getGenerateOmittedAsInternal()
{
return $this->generate_omitted_as_internal;
}
/**
* Setting this to true indicates to the client generators that methods
* that would be excluded from the generation should instead be generated
* in a way that indicates these methods should not be consumed by
* end users. How this is expressed is up to individual language
* implementations to decide. Some examples may be: added annotations,
* obfuscated identifiers, or other language idiomatic patterns.
*
* Generated from protobuf field bool generate_omitted_as_internal = 2;
* @param bool $var
* @return $this
*/
public function setGenerateOmittedAsInternal($var)
{
GPBUtil::checkBool($var);
$this->generate_omitted_as_internal = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Service.php
================================================
google.api.Service
*/
class Service extends \Google\Protobuf\Internal\Message
{
/**
* The service name, which is a DNS-like logical identifier for the
* service, such as `calendar.googleapis.com`. The service name
* typically goes through DNS verification to make sure the owner
* of the service also owns the DNS name.
*
* Generated from protobuf field string name = 1;
*/
protected $name = '';
/**
* The product title for this service, it is the name displayed in Google
* Cloud Console.
*
* Generated from protobuf field string title = 2;
*/
protected $title = '';
/**
* The Google project that owns this service.
*
* Generated from protobuf field string producer_project_id = 22;
*/
protected $producer_project_id = '';
/**
* A unique ID for a specific instance of this message, typically assigned
* by the client for tracking purpose. Must be no longer than 63 characters
* and only lower case letters, digits, '.', '_' and '-' are allowed. If
* empty, the server may choose to generate one instead.
*
* Generated from protobuf field string id = 33;
*/
protected $id = '';
/**
* A list of API interfaces exported by this service. Only the `name` field
* of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
* the configuration author, as the remaining fields will be derived from the
* IDL during the normalization process. It is an error to specify an API
* interface here which cannot be resolved against the associated IDL files.
*
* Generated from protobuf field repeated .google.protobuf.Api apis = 3;
*/
private $apis;
/**
* A list of all proto message types included in this API service.
* Types referenced directly or indirectly by the `apis` are automatically
* included. Messages which are not referenced but shall be included, such as
* types used by the `google.protobuf.Any` type, should be listed here by
* name by the configuration author. Example:
* types:
* - name: google.protobuf.Int32
*
* Generated from protobuf field repeated .google.protobuf.Type types = 4;
*/
private $types;
/**
* A list of all enum types included in this API service. Enums referenced
* directly or indirectly by the `apis` are automatically included. Enums
* which are not referenced but shall be included should be listed here by
* name by the configuration author. Example:
* enums:
* - name: google.someapi.v1.SomeEnum
*
* Generated from protobuf field repeated .google.protobuf.Enum enums = 5;
*/
private $enums;
/**
* Additional API documentation.
*
* Generated from protobuf field .google.api.Documentation documentation = 6;
*/
protected $documentation = null;
/**
* API backend configuration.
*
* Generated from protobuf field .google.api.Backend backend = 8;
*/
protected $backend = null;
/**
* HTTP configuration.
*
* Generated from protobuf field .google.api.Http http = 9;
*/
protected $http = null;
/**
* Quota configuration.
*
* Generated from protobuf field .google.api.Quota quota = 10;
*/
protected $quota = null;
/**
* Auth configuration.
*
* Generated from protobuf field .google.api.Authentication authentication = 11;
*/
protected $authentication = null;
/**
* Context configuration.
*
* Generated from protobuf field .google.api.Context context = 12;
*/
protected $context = null;
/**
* Configuration controlling usage of this service.
*
* Generated from protobuf field .google.api.Usage usage = 15;
*/
protected $usage = null;
/**
* Configuration for network endpoints. If this is empty, then an endpoint
* with the same name as the service is automatically generated to service all
* defined APIs.
*
* Generated from protobuf field repeated .google.api.Endpoint endpoints = 18;
*/
private $endpoints;
/**
* Configuration for the service control plane.
*
* Generated from protobuf field .google.api.Control control = 21;
*/
protected $control = null;
/**
* Defines the logs used by this service.
*
* Generated from protobuf field repeated .google.api.LogDescriptor logs = 23;
*/
private $logs;
/**
* Defines the metrics used by this service.
*
* Generated from protobuf field repeated .google.api.MetricDescriptor metrics = 24;
*/
private $metrics;
/**
* Defines the monitored resources used by this service. This is required
* by the [Service.monitoring][google.api.Service.monitoring] and
* [Service.logging][google.api.Service.logging] configurations.
*
* Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor monitored_resources = 25;
*/
private $monitored_resources;
/**
* Billing configuration.
*
* Generated from protobuf field .google.api.Billing billing = 26;
*/
protected $billing = null;
/**
* Logging configuration.
*
* Generated from protobuf field .google.api.Logging logging = 27;
*/
protected $logging = null;
/**
* Monitoring configuration.
*
* Generated from protobuf field .google.api.Monitoring monitoring = 28;
*/
protected $monitoring = null;
/**
* System parameter configuration.
*
* Generated from protobuf field .google.api.SystemParameters system_parameters = 29;
*/
protected $system_parameters = null;
/**
* Output only. The source information for this configuration if available.
*
* Generated from protobuf field .google.api.SourceInfo source_info = 37;
*/
protected $source_info = null;
/**
* Settings for [Google Cloud Client
* libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
* generated from APIs defined as protocol buffers.
*
* Generated from protobuf field .google.api.Publishing publishing = 45;
*/
protected $publishing = null;
/**
* Obsolete. Do not use.
* This field has no semantic meaning. The service config compiler always
* sets this field to `3`.
*
* Generated from protobuf field .google.protobuf.UInt32Value config_version = 20;
*/
protected $config_version = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* The service name, which is a DNS-like logical identifier for the
* service, such as `calendar.googleapis.com`. The service name
* typically goes through DNS verification to make sure the owner
* of the service also owns the DNS name.
* @type string $title
* The product title for this service, it is the name displayed in Google
* Cloud Console.
* @type string $producer_project_id
* The Google project that owns this service.
* @type string $id
* A unique ID for a specific instance of this message, typically assigned
* by the client for tracking purpose. Must be no longer than 63 characters
* and only lower case letters, digits, '.', '_' and '-' are allowed. If
* empty, the server may choose to generate one instead.
* @type array<\Google\Protobuf\Api>|\Google\Protobuf\Internal\RepeatedField $apis
* A list of API interfaces exported by this service. Only the `name` field
* of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
* the configuration author, as the remaining fields will be derived from the
* IDL during the normalization process. It is an error to specify an API
* interface here which cannot be resolved against the associated IDL files.
* @type array<\Google\Protobuf\Type>|\Google\Protobuf\Internal\RepeatedField $types
* A list of all proto message types included in this API service.
* Types referenced directly or indirectly by the `apis` are automatically
* included. Messages which are not referenced but shall be included, such as
* types used by the `google.protobuf.Any` type, should be listed here by
* name by the configuration author. Example:
* types:
* - name: google.protobuf.Int32
* @type array<\Google\Protobuf\Enum>|\Google\Protobuf\Internal\RepeatedField $enums
* A list of all enum types included in this API service. Enums referenced
* directly or indirectly by the `apis` are automatically included. Enums
* which are not referenced but shall be included should be listed here by
* name by the configuration author. Example:
* enums:
* - name: google.someapi.v1.SomeEnum
* @type \Google\Api\Documentation $documentation
* Additional API documentation.
* @type \Google\Api\Backend $backend
* API backend configuration.
* @type \Google\Api\Http $http
* HTTP configuration.
* @type \Google\Api\Quota $quota
* Quota configuration.
* @type \Google\Api\Authentication $authentication
* Auth configuration.
* @type \Google\Api\Context $context
* Context configuration.
* @type \Google\Api\Usage $usage
* Configuration controlling usage of this service.
* @type array<\Google\Api\Endpoint>|\Google\Protobuf\Internal\RepeatedField $endpoints
* Configuration for network endpoints. If this is empty, then an endpoint
* with the same name as the service is automatically generated to service all
* defined APIs.
* @type \Google\Api\Control $control
* Configuration for the service control plane.
* @type array<\Google\Api\LogDescriptor>|\Google\Protobuf\Internal\RepeatedField $logs
* Defines the logs used by this service.
* @type array<\Google\Api\MetricDescriptor>|\Google\Protobuf\Internal\RepeatedField $metrics
* Defines the metrics used by this service.
* @type array<\Google\Api\MonitoredResourceDescriptor>|\Google\Protobuf\Internal\RepeatedField $monitored_resources
* Defines the monitored resources used by this service. This is required
* by the [Service.monitoring][google.api.Service.monitoring] and
* [Service.logging][google.api.Service.logging] configurations.
* @type \Google\Api\Billing $billing
* Billing configuration.
* @type \Google\Api\Logging $logging
* Logging configuration.
* @type \Google\Api\Monitoring $monitoring
* Monitoring configuration.
* @type \Google\Api\SystemParameters $system_parameters
* System parameter configuration.
* @type \Google\Api\SourceInfo $source_info
* Output only. The source information for this configuration if available.
* @type \Google\Api\Publishing $publishing
* Settings for [Google Cloud Client
* libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
* generated from APIs defined as protocol buffers.
* @type \Google\Protobuf\UInt32Value $config_version
* Obsolete. Do not use.
* This field has no semantic meaning. The service config compiler always
* sets this field to `3`.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Service::initOnce();
parent::__construct($data);
}
/**
* The service name, which is a DNS-like logical identifier for the
* service, such as `calendar.googleapis.com`. The service name
* typically goes through DNS verification to make sure the owner
* of the service also owns the DNS name.
*
* Generated from protobuf field string name = 1;
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The service name, which is a DNS-like logical identifier for the
* service, such as `calendar.googleapis.com`. The service name
* typically goes through DNS verification to make sure the owner
* of the service also owns the DNS name.
*
* Generated from protobuf field string name = 1;
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* The product title for this service, it is the name displayed in Google
* Cloud Console.
*
* Generated from protobuf field string title = 2;
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* The product title for this service, it is the name displayed in Google
* Cloud Console.
*
* Generated from protobuf field string title = 2;
* @param string $var
* @return $this
*/
public function setTitle($var)
{
GPBUtil::checkString($var, True);
$this->title = $var;
return $this;
}
/**
* The Google project that owns this service.
*
* Generated from protobuf field string producer_project_id = 22;
* @return string
*/
public function getProducerProjectId()
{
return $this->producer_project_id;
}
/**
* The Google project that owns this service.
*
* Generated from protobuf field string producer_project_id = 22;
* @param string $var
* @return $this
*/
public function setProducerProjectId($var)
{
GPBUtil::checkString($var, True);
$this->producer_project_id = $var;
return $this;
}
/**
* A unique ID for a specific instance of this message, typically assigned
* by the client for tracking purpose. Must be no longer than 63 characters
* and only lower case letters, digits, '.', '_' and '-' are allowed. If
* empty, the server may choose to generate one instead.
*
* Generated from protobuf field string id = 33;
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* A unique ID for a specific instance of this message, typically assigned
* by the client for tracking purpose. Must be no longer than 63 characters
* and only lower case letters, digits, '.', '_' and '-' are allowed. If
* empty, the server may choose to generate one instead.
*
* Generated from protobuf field string id = 33;
* @param string $var
* @return $this
*/
public function setId($var)
{
GPBUtil::checkString($var, True);
$this->id = $var;
return $this;
}
/**
* A list of API interfaces exported by this service. Only the `name` field
* of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
* the configuration author, as the remaining fields will be derived from the
* IDL during the normalization process. It is an error to specify an API
* interface here which cannot be resolved against the associated IDL files.
*
* Generated from protobuf field repeated .google.protobuf.Api apis = 3;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getApis()
{
return $this->apis;
}
/**
* A list of API interfaces exported by this service. Only the `name` field
* of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
* the configuration author, as the remaining fields will be derived from the
* IDL during the normalization process. It is an error to specify an API
* interface here which cannot be resolved against the associated IDL files.
*
* Generated from protobuf field repeated .google.protobuf.Api apis = 3;
* @param array<\Google\Protobuf\Api>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setApis($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Api::class);
$this->apis = $arr;
return $this;
}
/**
* A list of all proto message types included in this API service.
* Types referenced directly or indirectly by the `apis` are automatically
* included. Messages which are not referenced but shall be included, such as
* types used by the `google.protobuf.Any` type, should be listed here by
* name by the configuration author. Example:
* types:
* - name: google.protobuf.Int32
*
* Generated from protobuf field repeated .google.protobuf.Type types = 4;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getTypes()
{
return $this->types;
}
/**
* A list of all proto message types included in this API service.
* Types referenced directly or indirectly by the `apis` are automatically
* included. Messages which are not referenced but shall be included, such as
* types used by the `google.protobuf.Any` type, should be listed here by
* name by the configuration author. Example:
* types:
* - name: google.protobuf.Int32
*
* Generated from protobuf field repeated .google.protobuf.Type types = 4;
* @param array<\Google\Protobuf\Type>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setTypes($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Type::class);
$this->types = $arr;
return $this;
}
/**
* A list of all enum types included in this API service. Enums referenced
* directly or indirectly by the `apis` are automatically included. Enums
* which are not referenced but shall be included should be listed here by
* name by the configuration author. Example:
* enums:
* - name: google.someapi.v1.SomeEnum
*
* Generated from protobuf field repeated .google.protobuf.Enum enums = 5;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getEnums()
{
return $this->enums;
}
/**
* A list of all enum types included in this API service. Enums referenced
* directly or indirectly by the `apis` are automatically included. Enums
* which are not referenced but shall be included should be listed here by
* name by the configuration author. Example:
* enums:
* - name: google.someapi.v1.SomeEnum
*
* Generated from protobuf field repeated .google.protobuf.Enum enums = 5;
* @param array<\Google\Protobuf\Enum>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setEnums($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Enum::class);
$this->enums = $arr;
return $this;
}
/**
* Additional API documentation.
*
* Generated from protobuf field .google.api.Documentation documentation = 6;
* @return \Google\Api\Documentation|null
*/
public function getDocumentation()
{
return $this->documentation;
}
public function hasDocumentation()
{
return isset($this->documentation);
}
public function clearDocumentation()
{
unset($this->documentation);
}
/**
* Additional API documentation.
*
* Generated from protobuf field .google.api.Documentation documentation = 6;
* @param \Google\Api\Documentation $var
* @return $this
*/
public function setDocumentation($var)
{
GPBUtil::checkMessage($var, \Google\Api\Documentation::class);
$this->documentation = $var;
return $this;
}
/**
* API backend configuration.
*
* Generated from protobuf field .google.api.Backend backend = 8;
* @return \Google\Api\Backend|null
*/
public function getBackend()
{
return $this->backend;
}
public function hasBackend()
{
return isset($this->backend);
}
public function clearBackend()
{
unset($this->backend);
}
/**
* API backend configuration.
*
* Generated from protobuf field .google.api.Backend backend = 8;
* @param \Google\Api\Backend $var
* @return $this
*/
public function setBackend($var)
{
GPBUtil::checkMessage($var, \Google\Api\Backend::class);
$this->backend = $var;
return $this;
}
/**
* HTTP configuration.
*
* Generated from protobuf field .google.api.Http http = 9;
* @return \Google\Api\Http|null
*/
public function getHttp()
{
return $this->http;
}
public function hasHttp()
{
return isset($this->http);
}
public function clearHttp()
{
unset($this->http);
}
/**
* HTTP configuration.
*
* Generated from protobuf field .google.api.Http http = 9;
* @param \Google\Api\Http $var
* @return $this
*/
public function setHttp($var)
{
GPBUtil::checkMessage($var, \Google\Api\Http::class);
$this->http = $var;
return $this;
}
/**
* Quota configuration.
*
* Generated from protobuf field .google.api.Quota quota = 10;
* @return \Google\Api\Quota|null
*/
public function getQuota()
{
return $this->quota;
}
public function hasQuota()
{
return isset($this->quota);
}
public function clearQuota()
{
unset($this->quota);
}
/**
* Quota configuration.
*
* Generated from protobuf field .google.api.Quota quota = 10;
* @param \Google\Api\Quota $var
* @return $this
*/
public function setQuota($var)
{
GPBUtil::checkMessage($var, \Google\Api\Quota::class);
$this->quota = $var;
return $this;
}
/**
* Auth configuration.
*
* Generated from protobuf field .google.api.Authentication authentication = 11;
* @return \Google\Api\Authentication|null
*/
public function getAuthentication()
{
return $this->authentication;
}
public function hasAuthentication()
{
return isset($this->authentication);
}
public function clearAuthentication()
{
unset($this->authentication);
}
/**
* Auth configuration.
*
* Generated from protobuf field .google.api.Authentication authentication = 11;
* @param \Google\Api\Authentication $var
* @return $this
*/
public function setAuthentication($var)
{
GPBUtil::checkMessage($var, \Google\Api\Authentication::class);
$this->authentication = $var;
return $this;
}
/**
* Context configuration.
*
* Generated from protobuf field .google.api.Context context = 12;
* @return \Google\Api\Context|null
*/
public function getContext()
{
return $this->context;
}
public function hasContext()
{
return isset($this->context);
}
public function clearContext()
{
unset($this->context);
}
/**
* Context configuration.
*
* Generated from protobuf field .google.api.Context context = 12;
* @param \Google\Api\Context $var
* @return $this
*/
public function setContext($var)
{
GPBUtil::checkMessage($var, \Google\Api\Context::class);
$this->context = $var;
return $this;
}
/**
* Configuration controlling usage of this service.
*
* Generated from protobuf field .google.api.Usage usage = 15;
* @return \Google\Api\Usage|null
*/
public function getUsage()
{
return $this->usage;
}
public function hasUsage()
{
return isset($this->usage);
}
public function clearUsage()
{
unset($this->usage);
}
/**
* Configuration controlling usage of this service.
*
* Generated from protobuf field .google.api.Usage usage = 15;
* @param \Google\Api\Usage $var
* @return $this
*/
public function setUsage($var)
{
GPBUtil::checkMessage($var, \Google\Api\Usage::class);
$this->usage = $var;
return $this;
}
/**
* Configuration for network endpoints. If this is empty, then an endpoint
* with the same name as the service is automatically generated to service all
* defined APIs.
*
* Generated from protobuf field repeated .google.api.Endpoint endpoints = 18;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getEndpoints()
{
return $this->endpoints;
}
/**
* Configuration for network endpoints. If this is empty, then an endpoint
* with the same name as the service is automatically generated to service all
* defined APIs.
*
* Generated from protobuf field repeated .google.api.Endpoint endpoints = 18;
* @param array<\Google\Api\Endpoint>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setEndpoints($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Endpoint::class);
$this->endpoints = $arr;
return $this;
}
/**
* Configuration for the service control plane.
*
* Generated from protobuf field .google.api.Control control = 21;
* @return \Google\Api\Control|null
*/
public function getControl()
{
return $this->control;
}
public function hasControl()
{
return isset($this->control);
}
public function clearControl()
{
unset($this->control);
}
/**
* Configuration for the service control plane.
*
* Generated from protobuf field .google.api.Control control = 21;
* @param \Google\Api\Control $var
* @return $this
*/
public function setControl($var)
{
GPBUtil::checkMessage($var, \Google\Api\Control::class);
$this->control = $var;
return $this;
}
/**
* Defines the logs used by this service.
*
* Generated from protobuf field repeated .google.api.LogDescriptor logs = 23;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getLogs()
{
return $this->logs;
}
/**
* Defines the logs used by this service.
*
* Generated from protobuf field repeated .google.api.LogDescriptor logs = 23;
* @param array<\Google\Api\LogDescriptor>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLogs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LogDescriptor::class);
$this->logs = $arr;
return $this;
}
/**
* Defines the metrics used by this service.
*
* Generated from protobuf field repeated .google.api.MetricDescriptor metrics = 24;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getMetrics()
{
return $this->metrics;
}
/**
* Defines the metrics used by this service.
*
* Generated from protobuf field repeated .google.api.MetricDescriptor metrics = 24;
* @param array<\Google\Api\MetricDescriptor>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMetrics($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricDescriptor::class);
$this->metrics = $arr;
return $this;
}
/**
* Defines the monitored resources used by this service. This is required
* by the [Service.monitoring][google.api.Service.monitoring] and
* [Service.logging][google.api.Service.logging] configurations.
*
* Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor monitored_resources = 25;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getMonitoredResources()
{
return $this->monitored_resources;
}
/**
* Defines the monitored resources used by this service. This is required
* by the [Service.monitoring][google.api.Service.monitoring] and
* [Service.logging][google.api.Service.logging] configurations.
*
* Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor monitored_resources = 25;
* @param array<\Google\Api\MonitoredResourceDescriptor>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMonitoredResources($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MonitoredResourceDescriptor::class);
$this->monitored_resources = $arr;
return $this;
}
/**
* Billing configuration.
*
* Generated from protobuf field .google.api.Billing billing = 26;
* @return \Google\Api\Billing|null
*/
public function getBilling()
{
return $this->billing;
}
public function hasBilling()
{
return isset($this->billing);
}
public function clearBilling()
{
unset($this->billing);
}
/**
* Billing configuration.
*
* Generated from protobuf field .google.api.Billing billing = 26;
* @param \Google\Api\Billing $var
* @return $this
*/
public function setBilling($var)
{
GPBUtil::checkMessage($var, \Google\Api\Billing::class);
$this->billing = $var;
return $this;
}
/**
* Logging configuration.
*
* Generated from protobuf field .google.api.Logging logging = 27;
* @return \Google\Api\Logging|null
*/
public function getLogging()
{
return $this->logging;
}
public function hasLogging()
{
return isset($this->logging);
}
public function clearLogging()
{
unset($this->logging);
}
/**
* Logging configuration.
*
* Generated from protobuf field .google.api.Logging logging = 27;
* @param \Google\Api\Logging $var
* @return $this
*/
public function setLogging($var)
{
GPBUtil::checkMessage($var, \Google\Api\Logging::class);
$this->logging = $var;
return $this;
}
/**
* Monitoring configuration.
*
* Generated from protobuf field .google.api.Monitoring monitoring = 28;
* @return \Google\Api\Monitoring|null
*/
public function getMonitoring()
{
return $this->monitoring;
}
public function hasMonitoring()
{
return isset($this->monitoring);
}
public function clearMonitoring()
{
unset($this->monitoring);
}
/**
* Monitoring configuration.
*
* Generated from protobuf field .google.api.Monitoring monitoring = 28;
* @param \Google\Api\Monitoring $var
* @return $this
*/
public function setMonitoring($var)
{
GPBUtil::checkMessage($var, \Google\Api\Monitoring::class);
$this->monitoring = $var;
return $this;
}
/**
* System parameter configuration.
*
* Generated from protobuf field .google.api.SystemParameters system_parameters = 29;
* @return \Google\Api\SystemParameters|null
*/
public function getSystemParameters()
{
return $this->system_parameters;
}
public function hasSystemParameters()
{
return isset($this->system_parameters);
}
public function clearSystemParameters()
{
unset($this->system_parameters);
}
/**
* System parameter configuration.
*
* Generated from protobuf field .google.api.SystemParameters system_parameters = 29;
* @param \Google\Api\SystemParameters $var
* @return $this
*/
public function setSystemParameters($var)
{
GPBUtil::checkMessage($var, \Google\Api\SystemParameters::class);
$this->system_parameters = $var;
return $this;
}
/**
* Output only. The source information for this configuration if available.
*
* Generated from protobuf field .google.api.SourceInfo source_info = 37;
* @return \Google\Api\SourceInfo|null
*/
public function getSourceInfo()
{
return $this->source_info;
}
public function hasSourceInfo()
{
return isset($this->source_info);
}
public function clearSourceInfo()
{
unset($this->source_info);
}
/**
* Output only. The source information for this configuration if available.
*
* Generated from protobuf field .google.api.SourceInfo source_info = 37;
* @param \Google\Api\SourceInfo $var
* @return $this
*/
public function setSourceInfo($var)
{
GPBUtil::checkMessage($var, \Google\Api\SourceInfo::class);
$this->source_info = $var;
return $this;
}
/**
* Settings for [Google Cloud Client
* libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
* generated from APIs defined as protocol buffers.
*
* Generated from protobuf field .google.api.Publishing publishing = 45;
* @return \Google\Api\Publishing|null
*/
public function getPublishing()
{
return $this->publishing;
}
public function hasPublishing()
{
return isset($this->publishing);
}
public function clearPublishing()
{
unset($this->publishing);
}
/**
* Settings for [Google Cloud Client
* libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
* generated from APIs defined as protocol buffers.
*
* Generated from protobuf field .google.api.Publishing publishing = 45;
* @param \Google\Api\Publishing $var
* @return $this
*/
public function setPublishing($var)
{
GPBUtil::checkMessage($var, \Google\Api\Publishing::class);
$this->publishing = $var;
return $this;
}
/**
* Obsolete. Do not use.
* This field has no semantic meaning. The service config compiler always
* sets this field to `3`.
*
* Generated from protobuf field .google.protobuf.UInt32Value config_version = 20;
* @return \Google\Protobuf\UInt32Value|null
*/
public function getConfigVersion()
{
return $this->config_version;
}
public function hasConfigVersion()
{
return isset($this->config_version);
}
public function clearConfigVersion()
{
unset($this->config_version);
}
/**
* Returns the unboxed value from getConfigVersion()
* Obsolete. Do not use.
* This field has no semantic meaning. The service config compiler always
* sets this field to `3`.
*
* Generated from protobuf field .google.protobuf.UInt32Value config_version = 20;
* @return int|null
*/
public function getConfigVersionUnwrapped()
{
return $this->readWrapperValue("config_version");
}
/**
* Obsolete. Do not use.
* This field has no semantic meaning. The service config compiler always
* sets this field to `3`.
*
* Generated from protobuf field .google.protobuf.UInt32Value config_version = 20;
* @param \Google\Protobuf\UInt32Value $var
* @return $this
*/
public function setConfigVersion($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\UInt32Value::class);
$this->config_version = $var;
return $this;
}
/**
* Sets the field by wrapping a primitive type in a Google\Protobuf\UInt32Value object.
* Obsolete. Do not use.
* This field has no semantic meaning. The service config compiler always
* sets this field to `3`.
*
* Generated from protobuf field .google.protobuf.UInt32Value config_version = 20;
* @param int|null $var
* @return $this
*/
public function setConfigVersionUnwrapped($var)
{
$this->writeWrapperValue("config_version", $var);
return $this;}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/SourceInfo.php
================================================
google.api.SourceInfo
*/
class SourceInfo extends \Google\Protobuf\Internal\Message
{
/**
* All files used during config generation.
*
* Generated from protobuf field repeated .google.protobuf.Any source_files = 1;
*/
private $source_files;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $source_files
* All files used during config generation.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\SourceInfo::initOnce();
parent::__construct($data);
}
/**
* All files used during config generation.
*
* Generated from protobuf field repeated .google.protobuf.Any source_files = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getSourceFiles()
{
return $this->source_files;
}
/**
* All files used during config generation.
*
* Generated from protobuf field repeated .google.protobuf.Any source_files = 1;
* @param array<\Google\Protobuf\Any>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setSourceFiles($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class);
$this->source_files = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/SystemParameter.php
================================================
google.api.SystemParameter
*/
class SystemParameter extends \Google\Protobuf\Internal\Message
{
/**
* Define the name of the parameter, such as "api_key" . It is case sensitive.
*
* Generated from protobuf field string name = 1;
*/
protected $name = '';
/**
* Define the HTTP header name to use for the parameter. It is case
* insensitive.
*
* Generated from protobuf field string http_header = 2;
*/
protected $http_header = '';
/**
* Define the URL query parameter name to use for the parameter. It is case
* sensitive.
*
* Generated from protobuf field string url_query_parameter = 3;
*/
protected $url_query_parameter = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* Define the name of the parameter, such as "api_key" . It is case sensitive.
* @type string $http_header
* Define the HTTP header name to use for the parameter. It is case
* insensitive.
* @type string $url_query_parameter
* Define the URL query parameter name to use for the parameter. It is case
* sensitive.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\SystemParameter::initOnce();
parent::__construct($data);
}
/**
* Define the name of the parameter, such as "api_key" . It is case sensitive.
*
* Generated from protobuf field string name = 1;
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Define the name of the parameter, such as "api_key" . It is case sensitive.
*
* Generated from protobuf field string name = 1;
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* Define the HTTP header name to use for the parameter. It is case
* insensitive.
*
* Generated from protobuf field string http_header = 2;
* @return string
*/
public function getHttpHeader()
{
return $this->http_header;
}
/**
* Define the HTTP header name to use for the parameter. It is case
* insensitive.
*
* Generated from protobuf field string http_header = 2;
* @param string $var
* @return $this
*/
public function setHttpHeader($var)
{
GPBUtil::checkString($var, True);
$this->http_header = $var;
return $this;
}
/**
* Define the URL query parameter name to use for the parameter. It is case
* sensitive.
*
* Generated from protobuf field string url_query_parameter = 3;
* @return string
*/
public function getUrlQueryParameter()
{
return $this->url_query_parameter;
}
/**
* Define the URL query parameter name to use for the parameter. It is case
* sensitive.
*
* Generated from protobuf field string url_query_parameter = 3;
* @param string $var
* @return $this
*/
public function setUrlQueryParameter($var)
{
GPBUtil::checkString($var, True);
$this->url_query_parameter = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/SystemParameterRule.php
================================================
google.api.SystemParameterRule
*/
class SystemParameterRule extends \Google\Protobuf\Internal\Message
{
/**
* Selects the methods to which this rule applies. Use '*' to indicate all
* methods in all APIs.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
*/
protected $selector = '';
/**
* Define parameters. Multiple names may be defined for a parameter.
* For a given method call, only one of them should be used. If multiple
* names are used the behavior is implementation-dependent.
* If none of the specified names are present the behavior is
* parameter-dependent.
*
* Generated from protobuf field repeated .google.api.SystemParameter parameters = 2;
*/
private $parameters;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $selector
* Selects the methods to which this rule applies. Use '*' to indicate all
* methods in all APIs.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
* @type array<\Google\Api\SystemParameter>|\Google\Protobuf\Internal\RepeatedField $parameters
* Define parameters. Multiple names may be defined for a parameter.
* For a given method call, only one of them should be used. If multiple
* names are used the behavior is implementation-dependent.
* If none of the specified names are present the behavior is
* parameter-dependent.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\SystemParameter::initOnce();
parent::__construct($data);
}
/**
* Selects the methods to which this rule applies. Use '*' to indicate all
* methods in all APIs.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @return string
*/
public function getSelector()
{
return $this->selector;
}
/**
* Selects the methods to which this rule applies. Use '*' to indicate all
* methods in all APIs.
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*
* Generated from protobuf field string selector = 1;
* @param string $var
* @return $this
*/
public function setSelector($var)
{
GPBUtil::checkString($var, True);
$this->selector = $var;
return $this;
}
/**
* Define parameters. Multiple names may be defined for a parameter.
* For a given method call, only one of them should be used. If multiple
* names are used the behavior is implementation-dependent.
* If none of the specified names are present the behavior is
* parameter-dependent.
*
* Generated from protobuf field repeated .google.api.SystemParameter parameters = 2;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getParameters()
{
return $this->parameters;
}
/**
* Define parameters. Multiple names may be defined for a parameter.
* For a given method call, only one of them should be used. If multiple
* names are used the behavior is implementation-dependent.
* If none of the specified names are present the behavior is
* parameter-dependent.
*
* Generated from protobuf field repeated .google.api.SystemParameter parameters = 2;
* @param array<\Google\Api\SystemParameter>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setParameters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\SystemParameter::class);
$this->parameters = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/SystemParameters.php
================================================
google.api.SystemParameters
*/
class SystemParameters extends \Google\Protobuf\Internal\Message
{
/**
* Define system parameters.
* The parameters defined here will override the default parameters
* implemented by the system. If this field is missing from the service
* config, default system parameters will be used. Default system parameters
* and names is implementation-dependent.
* Example: define api key for all methods
* system_parameters
* rules:
* - selector: "*"
* parameters:
* - name: api_key
* url_query_parameter: api_key
* Example: define 2 api key names for a specific method.
* system_parameters
* rules:
* - selector: "/ListShelves"
* parameters:
* - name: api_key
* http_header: Api-Key1
* - name: api_key
* http_header: Api-Key2
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.SystemParameterRule rules = 1;
*/
private $rules;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\Google\Api\SystemParameterRule>|\Google\Protobuf\Internal\RepeatedField $rules
* Define system parameters.
* The parameters defined here will override the default parameters
* implemented by the system. If this field is missing from the service
* config, default system parameters will be used. Default system parameters
* and names is implementation-dependent.
* Example: define api key for all methods
* system_parameters
* rules:
* - selector: "*"
* parameters:
* - name: api_key
* url_query_parameter: api_key
* Example: define 2 api key names for a specific method.
* system_parameters
* rules:
* - selector: "/ListShelves"
* parameters:
* - name: api_key
* http_header: Api-Key1
* - name: api_key
* http_header: Api-Key2
* **NOTE:** All service configuration rules follow "last one wins" order.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\SystemParameter::initOnce();
parent::__construct($data);
}
/**
* Define system parameters.
* The parameters defined here will override the default parameters
* implemented by the system. If this field is missing from the service
* config, default system parameters will be used. Default system parameters
* and names is implementation-dependent.
* Example: define api key for all methods
* system_parameters
* rules:
* - selector: "*"
* parameters:
* - name: api_key
* url_query_parameter: api_key
* Example: define 2 api key names for a specific method.
* system_parameters
* rules:
* - selector: "/ListShelves"
* parameters:
* - name: api_key
* http_header: Api-Key1
* - name: api_key
* http_header: Api-Key2
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.SystemParameterRule rules = 1;
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getRules()
{
return $this->rules;
}
/**
* Define system parameters.
* The parameters defined here will override the default parameters
* implemented by the system. If this field is missing from the service
* config, default system parameters will be used. Default system parameters
* and names is implementation-dependent.
* Example: define api key for all methods
* system_parameters
* rules:
* - selector: "*"
* parameters:
* - name: api_key
* url_query_parameter: api_key
* Example: define 2 api key names for a specific method.
* system_parameters
* rules:
* - selector: "/ListShelves"
* parameters:
* - name: api_key
* http_header: Api-Key1
* - name: api_key
* http_header: Api-Key2
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.SystemParameterRule rules = 1;
* @param array<\Google\Api\SystemParameterRule>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setRules($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\SystemParameterRule::class);
$this->rules = $arr;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/TypeReference.php
================================================
google.api.TypeReference
*/
class TypeReference extends \Google\Protobuf\Internal\Message
{
/**
* The name of the type that the annotated, generic field may represent.
* If the type is in the same protobuf package, the value can be the simple
* message name e.g., `"MyMessage"`. Otherwise, the value must be the
* fully-qualified message name e.g., `"google.library.v1.Book"`.
* If the type(s) are unknown to the service (e.g. the field accepts generic
* user input), use the wildcard `"*"` to denote this behavior.
* See [AIP-202](https://google.aip.dev/202#type-references) for more details.
*
* Generated from protobuf field string type_name = 1;
*/
protected $type_name = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $type_name
* The name of the type that the annotated, generic field may represent.
* If the type is in the same protobuf package, the value can be the simple
* message name e.g., `"MyMessage"`. Otherwise, the value must be the
* fully-qualified message name e.g., `"google.library.v1.Book"`.
* If the type(s) are unknown to the service (e.g. the field accepts generic
* user input), use the wildcard `"*"` to denote this behavior.
* See [AIP-202](https://google.aip.dev/202#type-references) for more details.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\FieldInfo::initOnce();
parent::__construct($data);
}
/**
* The name of the type that the annotated, generic field may represent.
* If the type is in the same protobuf package, the value can be the simple
* message name e.g., `"MyMessage"`. Otherwise, the value must be the
* fully-qualified message name e.g., `"google.library.v1.Book"`.
* If the type(s) are unknown to the service (e.g. the field accepts generic
* user input), use the wildcard `"*"` to denote this behavior.
* See [AIP-202](https://google.aip.dev/202#type-references) for more details.
*
* Generated from protobuf field string type_name = 1;
* @return string
*/
public function getTypeName()
{
return $this->type_name;
}
/**
* The name of the type that the annotated, generic field may represent.
* If the type is in the same protobuf package, the value can be the simple
* message name e.g., `"MyMessage"`. Otherwise, the value must be the
* fully-qualified message name e.g., `"google.library.v1.Book"`.
* If the type(s) are unknown to the service (e.g. the field accepts generic
* user input), use the wildcard `"*"` to denote this behavior.
* See [AIP-202](https://google.aip.dev/202#type-references) for more details.
*
* Generated from protobuf field string type_name = 1;
* @param string $var
* @return $this
*/
public function setTypeName($var)
{
GPBUtil::checkString($var, True);
$this->type_name = $var;
return $this;
}
}
================================================
FILE: lib/Google/vendor/google/common-protos/src/Api/Usage.php
================================================
google.api.Usage
*/
class Usage extends \Google\Protobuf\Internal\Message
{
/**
* Requirements that must be satisfied before a consumer project can use the
* service. Each requirement is of the form /;
* for example 'serviceusage.googleapis.com/billing-enabled'.
* For Google APIs, a Terms of Service requirement must be included here.
* Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud".
* Other Google APIs should include
* "serviceusage.googleapis.com/tos/universal". Additional ToS can be
* included based on the business needs.
*
* Generated from protobuf field repeated string requirements = 1;
*/
private $requirements;
/**
* A list of usage rules that apply to individual API methods.
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* Generated from protobuf field repeated .google.api.UsageRule rules = 6;
*/
private $rules;
/**
* The full resource name of a channel used for sending notifications to the
* service producer.
* Google Service Management currently only supports
* [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification
* channel. To use Google Cloud Pub/Sub as the channel, this must be the name
* of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format
* documented in https://cloud.google.com/pubsub/docs/overview.
*
* Generated from protobuf field string producer_notification_channel = 7;
*/
protected $producer_notification_channel = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array|\Google\Protobuf\Internal\RepeatedField $requirements
* Requirements that must be satisfied before a consumer project can use the
* service. Each requirement is of the form /