├── VERSION ├── metadata └── V1Beta1 │ ├── Common.php │ ├── ErrorGroupService.php │ ├── ErrorStatsService.php │ └── ReportErrorsService.php ├── .gitattributes ├── SECURITY.md ├── CONTRIBUTING.md ├── src ├── V1beta1 │ ├── README.md │ ├── QueryTimeRange_Period.php │ ├── DeleteEventsResponse.php │ ├── ReportErrorEventResponse.php │ ├── ErrorGroupServiceClient.php │ ├── ErrorStatsServiceClient.php │ ├── ReportErrorsServiceClient.php │ ├── resources │ │ ├── report_errors_service_rest_client_config.php │ │ ├── report_errors_service_client_config.json │ │ ├── report_errors_service_descriptor_config.php │ │ ├── error_group_service_client_config.json │ │ ├── error_group_service_descriptor_config.php │ │ ├── error_stats_service_client_config.json │ │ ├── error_group_service_rest_client_config.php │ │ ├── error_stats_service_rest_client_config.php │ │ └── error_stats_service_descriptor_config.php │ ├── TrackingIssue.php │ ├── ErrorGroupOrder.php │ ├── QueryTimeRange.php │ ├── ResolutionStatus.php │ ├── ReportErrorsServiceGrpcClient.php │ ├── ErrorGroupServiceGrpcClient.php │ ├── TimedCountAlignment.php │ ├── QueryTimeRange │ │ └── Period.php │ ├── UpdateGroupRequest.php │ ├── ErrorStatsServiceGrpcClient.php │ ├── TimedCount.php │ ├── SourceLocation.php │ ├── ListEventsResponse.php │ ├── DeleteEventsRequest.php │ ├── ServiceContextFilter.php │ ├── ReportErrorEventRequest.php │ ├── ListGroupStatsResponse.php │ ├── ErrorEvent.php │ ├── ServiceContext.php │ ├── HttpRequestContext.php │ ├── ErrorContext.php │ ├── GetGroupRequest.php │ ├── ErrorGroup.php │ ├── Client │ │ ├── ReportErrorsServiceClient.php │ │ └── ErrorGroupServiceClient.php │ └── Gapic │ │ └── ReportErrorsServiceGapicClient.php ├── prepend.php └── Bootstrap.php ├── composer.json ├── CODE_OF_CONDUCT.md ├── README.md └── LICENSE /VERSION: -------------------------------------------------------------------------------- 1 | 0.25.1 2 | -------------------------------------------------------------------------------- /metadata/V1Beta1/Common.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-errorreporting/HEAD/metadata/V1Beta1/Common.php -------------------------------------------------------------------------------- /metadata/V1Beta1/ErrorGroupService.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-errorreporting/HEAD/metadata/V1Beta1/ErrorGroupService.php -------------------------------------------------------------------------------- /metadata/V1Beta1/ErrorStatsService.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-errorreporting/HEAD/metadata/V1Beta1/ErrorStatsService.php -------------------------------------------------------------------------------- /metadata/V1Beta1/ReportErrorsService.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-errorreporting/HEAD/metadata/V1Beta1/ReportErrorsService.php -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | /*.xml.dist export-ignore 2 | /tests export-ignore 3 | /.github export-ignore 4 | /samples export-ignore 5 | /.OwlBot.yaml export-ignore 6 | /owlbot.py export-ignore 7 | /src/**/gapic_metadata.json export-ignore 8 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). 4 | 5 | The Google Security Team will respond within 5 working days of your report on g.co/vulnz. 6 | 7 | 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. 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. We accept 4 | and review pull requests against the main 5 | [Google Cloud PHP](https://github.com/googleapis/google-cloud-php) 6 | repository, which contains all of our client libraries. You will also need to 7 | sign a Contributor License Agreement. For more details about how to contribute, 8 | see the 9 | [CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) 10 | file in the main Google Cloud PHP repository. 11 | -------------------------------------------------------------------------------- /src/V1beta1/README.md: -------------------------------------------------------------------------------- 1 | # Stackdriver Error Reporting V1beta1 generated client for PHP 2 | 3 | ### Sample 4 | 5 | ```php 6 | require 'vendor/autoload.php'; 7 | 8 | use Google\Cloud\ErrorReporting\V1beta1\ReportErrorsServiceClient; 9 | use Google\Cloud\ErrorReporting\\V1beta1\ReportedErrorEvent; 10 | 11 | $reportErrorsServiceClient = new ReportErrorsServiceClient(); 12 | $formattedProjectName = $reportErrorsServiceClient->projectName('[PROJECT]'); 13 | $event = new ReportedErrorEvent(); 14 | 15 | try { 16 | $response = $reportErrorsServiceClient->reportErrorEvent($formattedProjectName, $event); 17 | } finally { 18 | $reportErrorsServiceClient->close(); 19 | } 20 | ``` 21 | -------------------------------------------------------------------------------- /src/V1beta1/QueryTimeRange_Period.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse 15 | */ 16 | class DeleteEventsResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param array $data { 23 | * Optional. Data for populating the Message object. 24 | * 25 | * } 26 | */ 27 | public function __construct($data = NULL) { 28 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); 29 | parent::__construct($data); 30 | } 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/V1beta1/ReportErrorEventResponse.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse 16 | */ 17 | class ReportErrorEventResponse extends \Google\Protobuf\Internal\Message 18 | { 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param array $data { 24 | * Optional. Data for populating the Message object. 25 | * 26 | * } 27 | */ 28 | public function __construct($data = NULL) { 29 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ReportErrorsService::initOnce(); 30 | parent::__construct($data); 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "google/cloud-error-reporting", 3 | "description": "Stackdriver Error Reporting Client for PHP", 4 | "license": "Apache-2.0", 5 | "minimum-stability": "stable", 6 | "require": { 7 | "php": "^8.1", 8 | "google/cloud-logging": "^1.29", 9 | "google/gax": "^1.38.0" 10 | }, 11 | "require-dev": { 12 | "phpunit/phpunit": "^9.0", 13 | "phpspec/prophecy-phpunit": "^2.0", 14 | "google/cloud-core": "^1.52.7", 15 | "psr/log": "^2.0||^3.0" 16 | }, 17 | "suggest": { 18 | "ext-grpc": "The gRPC extension allows more granular control over Error Reporting", 19 | "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." 20 | }, 21 | "extra": { 22 | "component": { 23 | "id": "cloud-error-reporting", 24 | "target": "googleapis/google-cloud-php-errorreporting.git", 25 | "path": "ErrorReporting", 26 | "entry": null 27 | } 28 | }, 29 | "autoload": { 30 | "psr-4": { 31 | "Google\\Cloud\\ErrorReporting\\": "src", 32 | "GPBMetadata\\Google\\Devtools\\Clouderrorreporting\\": "metadata" 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/V1beta1/ErrorGroupServiceClient.php: -------------------------------------------------------------------------------- 1 | [ 25 | 'google.devtools.clouderrorreporting.v1beta1.ReportErrorsService' => [ 26 | 'ReportErrorEvent' => [ 27 | 'method' => 'post', 28 | 'uriTemplate' => '/v1beta1/{project_name=projects/*}/events:report', 29 | 'body' => 'event', 30 | 'placeholders' => [ 31 | 'project_name' => [ 32 | 'getters' => [ 33 | 'getProjectName', 34 | ], 35 | ], 36 | ], 37 | ], 38 | ], 39 | ], 40 | 'numericEnums' => true, 41 | ]; 42 | -------------------------------------------------------------------------------- /src/V1beta1/resources/report_errors_service_client_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "interfaces": { 3 | "google.devtools.clouderrorreporting.v1beta1.ReportErrorsService": { 4 | "retry_codes": { 5 | "no_retry_codes": [], 6 | "no_retry_1_codes": [] 7 | }, 8 | "retry_params": { 9 | "no_retry_params": { 10 | "initial_retry_delay_millis": 0, 11 | "retry_delay_multiplier": 0.0, 12 | "max_retry_delay_millis": 0, 13 | "initial_rpc_timeout_millis": 0, 14 | "rpc_timeout_multiplier": 1.0, 15 | "max_rpc_timeout_millis": 0, 16 | "total_timeout_millis": 0 17 | }, 18 | "no_retry_1_params": { 19 | "initial_retry_delay_millis": 0, 20 | "retry_delay_multiplier": 0.0, 21 | "max_retry_delay_millis": 0, 22 | "initial_rpc_timeout_millis": 600000, 23 | "rpc_timeout_multiplier": 1.0, 24 | "max_rpc_timeout_millis": 600000, 25 | "total_timeout_millis": 600000 26 | } 27 | }, 28 | "methods": { 29 | "ReportErrorEvent": { 30 | "timeout_millis": 600000, 31 | "retry_codes_name": "no_retry_1_codes", 32 | "retry_params_name": "no_retry_1_params" 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/V1beta1/resources/report_errors_service_descriptor_config.php: -------------------------------------------------------------------------------- 1 | [ 25 | 'google.devtools.clouderrorreporting.v1beta1.ReportErrorsService' => [ 26 | 'ReportErrorEvent' => [ 27 | 'callType' => \Google\ApiCore\Call::UNARY_CALL, 28 | 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\ReportErrorEventResponse', 29 | 'headerParams' => [ 30 | [ 31 | 'keyName' => 'project_name', 32 | 'fieldAccessors' => [ 33 | 'getProjectName', 34 | ], 35 | ], 36 | ], 37 | ], 38 | 'templateMap' => [ 39 | 'project' => 'projects/{project}', 40 | ], 41 | ], 42 | ], 43 | ]; 44 | -------------------------------------------------------------------------------- /src/V1beta1/resources/error_group_service_client_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "interfaces": { 3 | "google.devtools.clouderrorreporting.v1beta1.ErrorGroupService": { 4 | "retry_codes": { 5 | "no_retry_codes": [], 6 | "retry_policy_1_codes": [ 7 | "UNAVAILABLE", 8 | "DEADLINE_EXCEEDED" 9 | ] 10 | }, 11 | "retry_params": { 12 | "no_retry_params": { 13 | "initial_retry_delay_millis": 0, 14 | "retry_delay_multiplier": 0.0, 15 | "max_retry_delay_millis": 0, 16 | "initial_rpc_timeout_millis": 0, 17 | "rpc_timeout_multiplier": 1.0, 18 | "max_rpc_timeout_millis": 0, 19 | "total_timeout_millis": 0 20 | }, 21 | "retry_policy_1_params": { 22 | "initial_retry_delay_millis": 100, 23 | "retry_delay_multiplier": 1.3, 24 | "max_retry_delay_millis": 60000, 25 | "initial_rpc_timeout_millis": 600000, 26 | "rpc_timeout_multiplier": 1.0, 27 | "max_rpc_timeout_millis": 600000, 28 | "total_timeout_millis": 600000 29 | } 30 | }, 31 | "methods": { 32 | "GetGroup": { 33 | "timeout_millis": 600000, 34 | "retry_codes_name": "retry_policy_1_codes", 35 | "retry_params_name": "retry_policy_1_params" 36 | }, 37 | "UpdateGroup": { 38 | "timeout_millis": 600000, 39 | "retry_codes_name": "retry_policy_1_codes", 40 | "retry_params_name": "retry_policy_1_params" 41 | } 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, 4 | and in the interest of fostering an open and welcoming community, 5 | we pledge to respect all people who contribute through reporting issues, 6 | posting feature requests, updating documentation, 7 | submitting pull requests or patches, and other activities. 8 | 9 | We are committed to making participation in this project 10 | a harassment-free experience for everyone, 11 | regardless of level of experience, gender, gender identity and expression, 12 | sexual orientation, disability, personal appearance, 13 | body size, race, ethnicity, age, religion, or nationality. 14 | 15 | Examples of unacceptable behavior by participants include: 16 | 17 | * The use of sexualized language or imagery 18 | * Personal attacks 19 | * Trolling or insulting/derogatory comments 20 | * Public or private harassment 21 | * Publishing other's private information, 22 | such as physical or electronic 23 | addresses, without explicit permission 24 | * Other unethical or unprofessional conduct. 25 | 26 | Project maintainers have the right and responsibility to remove, edit, or reject 27 | comments, commits, code, wiki edits, issues, and other contributions 28 | that are not aligned to this Code of Conduct. 29 | By adopting this Code of Conduct, 30 | project maintainers commit themselves to fairly and consistently 31 | applying these principles to every aspect of managing this project. 32 | Project maintainers who do not follow or enforce the Code of Conduct 33 | may be permanently removed from the project team. 34 | 35 | This code of conduct applies both within project spaces and in public spaces 36 | when an individual is representing the project or its community. 37 | 38 | Instances of abusive, harassing, or otherwise unacceptable behavior 39 | may be reported by opening an issue 40 | or contacting one or more of the project maintainers. 41 | 42 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, 43 | available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) -------------------------------------------------------------------------------- /src/V1beta1/resources/error_group_service_descriptor_config.php: -------------------------------------------------------------------------------- 1 | [ 25 | 'google.devtools.clouderrorreporting.v1beta1.ErrorGroupService' => [ 26 | 'GetGroup' => [ 27 | 'callType' => \Google\ApiCore\Call::UNARY_CALL, 28 | 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\ErrorGroup', 29 | 'headerParams' => [ 30 | [ 31 | 'keyName' => 'group_name', 32 | 'fieldAccessors' => [ 33 | 'getGroupName', 34 | ], 35 | ], 36 | ], 37 | ], 38 | 'UpdateGroup' => [ 39 | 'callType' => \Google\ApiCore\Call::UNARY_CALL, 40 | 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\ErrorGroup', 41 | 'headerParams' => [ 42 | [ 43 | 'keyName' => 'group.name', 44 | 'fieldAccessors' => [ 45 | 'getGroup', 46 | 'getName', 47 | ], 48 | ], 49 | ], 50 | ], 51 | 'templateMap' => [ 52 | 'errorGroup' => 'projects/{project}/groups/{group}', 53 | ], 54 | ], 55 | ], 56 | ]; 57 | -------------------------------------------------------------------------------- /src/V1beta1/resources/error_stats_service_client_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "interfaces": { 3 | "google.devtools.clouderrorreporting.v1beta1.ErrorStatsService": { 4 | "retry_codes": { 5 | "no_retry_codes": [], 6 | "retry_policy_1_codes": [ 7 | "UNAVAILABLE", 8 | "DEADLINE_EXCEEDED" 9 | ] 10 | }, 11 | "retry_params": { 12 | "no_retry_params": { 13 | "initial_retry_delay_millis": 0, 14 | "retry_delay_multiplier": 0.0, 15 | "max_retry_delay_millis": 0, 16 | "initial_rpc_timeout_millis": 0, 17 | "rpc_timeout_multiplier": 1.0, 18 | "max_rpc_timeout_millis": 0, 19 | "total_timeout_millis": 0 20 | }, 21 | "retry_policy_1_params": { 22 | "initial_retry_delay_millis": 100, 23 | "retry_delay_multiplier": 1.3, 24 | "max_retry_delay_millis": 60000, 25 | "initial_rpc_timeout_millis": 600000, 26 | "rpc_timeout_multiplier": 1.0, 27 | "max_rpc_timeout_millis": 600000, 28 | "total_timeout_millis": 600000 29 | } 30 | }, 31 | "methods": { 32 | "DeleteEvents": { 33 | "timeout_millis": 600000, 34 | "retry_codes_name": "retry_policy_1_codes", 35 | "retry_params_name": "retry_policy_1_params" 36 | }, 37 | "ListEvents": { 38 | "timeout_millis": 600000, 39 | "retry_codes_name": "retry_policy_1_codes", 40 | "retry_params_name": "retry_policy_1_params" 41 | }, 42 | "ListGroupStats": { 43 | "timeout_millis": 600000, 44 | "retry_codes_name": "retry_policy_1_codes", 45 | "retry_params_name": "retry_policy_1_params" 46 | } 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/V1beta1/TrackingIssue.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.TrackingIssue 15 | */ 16 | class TrackingIssue extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * A URL pointing to a related entry in an issue tracking system. 20 | * Example: `https://github.com/user/project/issues/4` 21 | * 22 | * Generated from protobuf field string url = 1; 23 | */ 24 | private $url = ''; 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param array $data { 30 | * Optional. Data for populating the Message object. 31 | * 32 | * @type string $url 33 | * A URL pointing to a related entry in an issue tracking system. 34 | * Example: `https://github.com/user/project/issues/4` 35 | * } 36 | */ 37 | public function __construct($data = NULL) { 38 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); 39 | parent::__construct($data); 40 | } 41 | 42 | /** 43 | * A URL pointing to a related entry in an issue tracking system. 44 | * Example: `https://github.com/user/project/issues/4` 45 | * 46 | * Generated from protobuf field string url = 1; 47 | * @return string 48 | */ 49 | public function getUrl() 50 | { 51 | return $this->url; 52 | } 53 | 54 | /** 55 | * A URL pointing to a related entry in an issue tracking system. 56 | * Example: `https://github.com/user/project/issues/4` 57 | * 58 | * Generated from protobuf field string url = 1; 59 | * @param string $var 60 | * @return $this 61 | */ 62 | public function setUrl($var) 63 | { 64 | GPBUtil::checkString($var, True); 65 | $this->url = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/V1beta1/resources/error_group_service_rest_client_config.php: -------------------------------------------------------------------------------- 1 | [ 25 | 'google.devtools.clouderrorreporting.v1beta1.ErrorGroupService' => [ 26 | 'GetGroup' => [ 27 | 'method' => 'get', 28 | 'uriTemplate' => '/v1beta1/{group_name=projects/*/groups/*}', 29 | 'additionalBindings' => [ 30 | [ 31 | 'method' => 'get', 32 | 'uriTemplate' => '/v1beta1/{group_name=projects/*/locations/*/groups/*}', 33 | ], 34 | ], 35 | 'placeholders' => [ 36 | 'group_name' => [ 37 | 'getters' => [ 38 | 'getGroupName', 39 | ], 40 | ], 41 | ], 42 | ], 43 | 'UpdateGroup' => [ 44 | 'method' => 'put', 45 | 'uriTemplate' => '/v1beta1/{group.name=projects/*/groups/*}', 46 | 'body' => 'group', 47 | 'additionalBindings' => [ 48 | [ 49 | 'method' => 'put', 50 | 'uriTemplate' => '/v1beta1/{group.name=projects/*/locations/*/groups/*}', 51 | 'body' => 'group', 52 | ], 53 | ], 54 | 'placeholders' => [ 55 | 'group.name' => [ 56 | 'getters' => [ 57 | 'getGroup', 58 | 'getName', 59 | ], 60 | ], 61 | ], 62 | ], 63 | ], 64 | ], 65 | 'numericEnums' => true, 66 | ]; 67 | -------------------------------------------------------------------------------- /src/V1beta1/ErrorGroupOrder.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ErrorGroupOrder 13 | */ 14 | class ErrorGroupOrder 15 | { 16 | /** 17 | * No group order specified. 18 | * 19 | * Generated from protobuf enum GROUP_ORDER_UNSPECIFIED = 0; 20 | */ 21 | const GROUP_ORDER_UNSPECIFIED = 0; 22 | /** 23 | * Total count of errors in the given time window in descending order. 24 | * 25 | * Generated from protobuf enum COUNT_DESC = 1; 26 | */ 27 | const COUNT_DESC = 1; 28 | /** 29 | * Timestamp when the group was last seen in the given time window 30 | * in descending order. 31 | * 32 | * Generated from protobuf enum LAST_SEEN_DESC = 2; 33 | */ 34 | const LAST_SEEN_DESC = 2; 35 | /** 36 | * Timestamp when the group was created in descending order. 37 | * 38 | * Generated from protobuf enum CREATED_DESC = 3; 39 | */ 40 | const CREATED_DESC = 3; 41 | /** 42 | * Number of affected users in the given time window in descending order. 43 | * 44 | * Generated from protobuf enum AFFECTED_USERS_DESC = 4; 45 | */ 46 | const AFFECTED_USERS_DESC = 4; 47 | 48 | private static $valueToName = [ 49 | self::GROUP_ORDER_UNSPECIFIED => 'GROUP_ORDER_UNSPECIFIED', 50 | self::COUNT_DESC => 'COUNT_DESC', 51 | self::LAST_SEEN_DESC => 'LAST_SEEN_DESC', 52 | self::CREATED_DESC => 'CREATED_DESC', 53 | self::AFFECTED_USERS_DESC => 'AFFECTED_USERS_DESC', 54 | ]; 55 | 56 | public static function name($value) 57 | { 58 | if (!isset(self::$valueToName[$value])) { 59 | throw new UnexpectedValueException(sprintf( 60 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 61 | } 62 | return self::$valueToName[$value]; 63 | } 64 | 65 | 66 | public static function value($name) 67 | { 68 | $const = __CLASS__ . '::' . strtoupper($name); 69 | if (!defined($const)) { 70 | throw new UnexpectedValueException(sprintf( 71 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 72 | } 73 | return constant($const); 74 | } 75 | } 76 | 77 | -------------------------------------------------------------------------------- /src/V1beta1/QueryTimeRange.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.QueryTimeRange 21 | */ 22 | class QueryTimeRange extends \Google\Protobuf\Internal\Message 23 | { 24 | /** 25 | * Restricts the query to the specified time range. 26 | * 27 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange.Period period = 1; 28 | */ 29 | private $period = 0; 30 | 31 | /** 32 | * Constructor. 33 | * 34 | * @param array $data { 35 | * Optional. Data for populating the Message object. 36 | * 37 | * @type int $period 38 | * Restricts the query to the specified time range. 39 | * } 40 | */ 41 | public function __construct($data = NULL) { 42 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); 43 | parent::__construct($data); 44 | } 45 | 46 | /** 47 | * Restricts the query to the specified time range. 48 | * 49 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange.Period period = 1; 50 | * @return int 51 | */ 52 | public function getPeriod() 53 | { 54 | return $this->period; 55 | } 56 | 57 | /** 58 | * Restricts the query to the specified time range. 59 | * 60 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.QueryTimeRange.Period period = 1; 61 | * @param int $var 62 | * @return $this 63 | */ 64 | public function setPeriod($var) 65 | { 66 | GPBUtil::checkEnum($var, \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange\Period::class); 67 | $this->period = $var; 68 | 69 | return $this; 70 | } 71 | 72 | } 73 | 74 | -------------------------------------------------------------------------------- /src/V1beta1/ResolutionStatus.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ResolutionStatus 13 | */ 14 | class ResolutionStatus 15 | { 16 | /** 17 | * Status is unknown. When left unspecified in requests, it is treated like 18 | * OPEN. 19 | * 20 | * Generated from protobuf enum RESOLUTION_STATUS_UNSPECIFIED = 0; 21 | */ 22 | const RESOLUTION_STATUS_UNSPECIFIED = 0; 23 | /** 24 | * The error group is not being addressed. This is the default for 25 | * new groups. It is also used for errors re-occurring after marked RESOLVED. 26 | * 27 | * Generated from protobuf enum OPEN = 1; 28 | */ 29 | const OPEN = 1; 30 | /** 31 | * Error Group manually acknowledged, it can have an issue link attached. 32 | * 33 | * Generated from protobuf enum ACKNOWLEDGED = 2; 34 | */ 35 | const ACKNOWLEDGED = 2; 36 | /** 37 | * Error Group manually resolved, more events for this group are not expected 38 | * to occur. 39 | * 40 | * Generated from protobuf enum RESOLVED = 3; 41 | */ 42 | const RESOLVED = 3; 43 | /** 44 | * The error group is muted and excluded by default on group stats requests. 45 | * 46 | * Generated from protobuf enum MUTED = 4; 47 | */ 48 | const MUTED = 4; 49 | 50 | private static $valueToName = [ 51 | self::RESOLUTION_STATUS_UNSPECIFIED => 'RESOLUTION_STATUS_UNSPECIFIED', 52 | self::OPEN => 'OPEN', 53 | self::ACKNOWLEDGED => 'ACKNOWLEDGED', 54 | self::RESOLVED => 'RESOLVED', 55 | self::MUTED => 'MUTED', 56 | ]; 57 | 58 | public static function name($value) 59 | { 60 | if (!isset(self::$valueToName[$value])) { 61 | throw new UnexpectedValueException(sprintf( 62 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 63 | } 64 | return self::$valueToName[$value]; 65 | } 66 | 67 | 68 | public static function value($name) 69 | { 70 | $const = __CLASS__ . '::' . strtoupper($name); 71 | if (!defined($const)) { 72 | throw new UnexpectedValueException(sprintf( 73 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 74 | } 75 | return constant($const); 76 | } 77 | } 78 | 79 | -------------------------------------------------------------------------------- /src/prepend.php: -------------------------------------------------------------------------------- 1 | _simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ReportErrorsService/ReportErrorEvent', 58 | $argument, 59 | ['\Google\Cloud\ErrorReporting\V1beta1\ReportErrorEventResponse', 'decode'], 60 | $metadata, $options); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/V1beta1/ErrorGroupServiceGrpcClient.php: -------------------------------------------------------------------------------- 1 | _simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ErrorGroupService/GetGroup', 45 | $argument, 46 | ['\Google\Cloud\ErrorReporting\V1beta1\ErrorGroup', 'decode'], 47 | $metadata, $options); 48 | } 49 | 50 | /** 51 | * Replace the data for the specified group. 52 | * Fails if the group does not exist. 53 | * @param \Google\Cloud\ErrorReporting\V1beta1\UpdateGroupRequest $argument input argument 54 | * @param array $metadata metadata 55 | * @param array $options call options 56 | * @return \Grpc\UnaryCall 57 | */ 58 | public function UpdateGroup(\Google\Cloud\ErrorReporting\V1beta1\UpdateGroupRequest $argument, 59 | $metadata = [], $options = []) { 60 | return $this->_simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ErrorGroupService/UpdateGroup', 61 | $argument, 62 | ['\Google\Cloud\ErrorReporting\V1beta1\ErrorGroup', 'decode'], 63 | $metadata, $options); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/V1beta1/TimedCountAlignment.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.TimedCountAlignment 13 | */ 14 | class TimedCountAlignment 15 | { 16 | /** 17 | * No alignment specified. 18 | * 19 | * Generated from protobuf enum ERROR_COUNT_ALIGNMENT_UNSPECIFIED = 0; 20 | */ 21 | const ERROR_COUNT_ALIGNMENT_UNSPECIFIED = 0; 22 | /** 23 | * The time periods shall be consecutive, have width equal to the 24 | * requested duration, and be aligned at the 25 | * [alignment_time] 26 | * [google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest.alignment_time] 27 | * provided in the request. 28 | * The [alignment_time] 29 | * [google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest.alignment_time] 30 | * does not have to be inside the query period but even if it is outside, only 31 | * time periods are returned which overlap with the query period. 32 | * A rounded alignment will typically result in a different size of the first 33 | * or the last time period. 34 | * 35 | * Generated from protobuf enum ALIGNMENT_EQUAL_ROUNDED = 1; 36 | */ 37 | const ALIGNMENT_EQUAL_ROUNDED = 1; 38 | /** 39 | * The time periods shall be consecutive, have width equal to the 40 | * requested duration, and be aligned at the end of the requested time 41 | * period. This can result in a different size of the 42 | * first time period. 43 | * 44 | * Generated from protobuf enum ALIGNMENT_EQUAL_AT_END = 2; 45 | */ 46 | const ALIGNMENT_EQUAL_AT_END = 2; 47 | 48 | private static $valueToName = [ 49 | self::ERROR_COUNT_ALIGNMENT_UNSPECIFIED => 'ERROR_COUNT_ALIGNMENT_UNSPECIFIED', 50 | self::ALIGNMENT_EQUAL_ROUNDED => 'ALIGNMENT_EQUAL_ROUNDED', 51 | self::ALIGNMENT_EQUAL_AT_END => 'ALIGNMENT_EQUAL_AT_END', 52 | ]; 53 | 54 | public static function name($value) 55 | { 56 | if (!isset(self::$valueToName[$value])) { 57 | throw new UnexpectedValueException(sprintf( 58 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 59 | } 60 | return self::$valueToName[$value]; 61 | } 62 | 63 | 64 | public static function value($name) 65 | { 66 | $const = __CLASS__ . '::' . strtoupper($name); 67 | if (!defined($const)) { 68 | throw new UnexpectedValueException(sprintf( 69 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 70 | } 71 | return constant($const); 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Stackdriver Error Reporting for PHP 2 | 3 | > Idiomatic PHP client for [Stackdriver Error Reporting](https://cloud.google.com/error-reporting/). 4 | 5 | [![Latest Stable Version](https://poser.pugx.org/google/cloud-error-reporting/v/stable)](https://packagist.org/packages/google/cloud-error-reporting) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-error-reporting.svg)](https://packagist.org/packages/google/cloud-error-reporting) 6 | 7 | * [API documentation](https://cloud.google.com/php/docs/reference/cloud-error-reporting/latest) 8 | 9 | **NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any 10 | support requests, bug reports, or development contributions should be directed to 11 | that project. 12 | 13 | Stackdriver Error Reporting counts, analyzes and aggregates the crashes in your running cloud services. 14 | 15 | ### Installation 16 | 17 | To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). 18 | 19 | Now install this component: 20 | 21 | ```sh 22 | $ composer require google/cloud-error-reporting 23 | ``` 24 | 25 | This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits offered by gRPC (such as streaming methods) 26 | please see our [gRPC installation guide](https://cloud.google.com/php/grpc). 27 | 28 | ### Authentication 29 | 30 | Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information 31 | on authenticating your client. Once authenticated, you'll be ready to start making requests. 32 | 33 | ### Sample 34 | 35 | ```php 36 | use Google\ApiCore\ApiException; 37 | use Google\Cloud\ErrorReporting\V1beta1\Client\ErrorGroupServiceClient; 38 | use Google\Cloud\ErrorReporting\V1beta1\ErrorGroup; 39 | use Google\Cloud\ErrorReporting\V1beta1\GetGroupRequest; 40 | 41 | // Create a client. 42 | $errorGroupServiceClient = new ErrorGroupServiceClient(); 43 | 44 | // Prepare the request message. 45 | $request = (new GetGroupRequest()) 46 | ->setGroupName($formattedGroupName); 47 | 48 | // Call the API and handle any network failures. 49 | try { 50 | /** @var ErrorGroup $response */ 51 | $response = $errorGroupServiceClient->getGroup($request); 52 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 53 | } catch (ApiException $ex) { 54 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 55 | } 56 | ``` 57 | 58 | ### Debugging 59 | 60 | Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md) 61 | for more information about the debugging tools. 62 | 63 | ### Version 64 | 65 | This component is considered beta. As such, it should be expected to be mostly 66 | stable and we're working towards a release candidate. We will address issues 67 | and requests with a higher priority. 68 | 69 | ### Next Steps 70 | 71 | 1. Understand the [official documentation](https://cloud.google.com/error-reporting/docs/). 72 | 2. Take a look at [in-depth usage samples](https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/error_reporting). 73 | -------------------------------------------------------------------------------- /src/V1beta1/QueryTimeRange/Period.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.QueryTimeRange.Period 13 | */ 14 | class Period 15 | { 16 | /** 17 | * Do not use. 18 | * 19 | * Generated from protobuf enum PERIOD_UNSPECIFIED = 0; 20 | */ 21 | const PERIOD_UNSPECIFIED = 0; 22 | /** 23 | * Retrieve data for the last hour. 24 | * Recommended minimum timed count duration: 1 min. 25 | * 26 | * Generated from protobuf enum PERIOD_1_HOUR = 1; 27 | */ 28 | const PERIOD_1_HOUR = 1; 29 | /** 30 | * Retrieve data for the last 6 hours. 31 | * Recommended minimum timed count duration: 10 min. 32 | * 33 | * Generated from protobuf enum PERIOD_6_HOURS = 2; 34 | */ 35 | const PERIOD_6_HOURS = 2; 36 | /** 37 | * Retrieve data for the last day. 38 | * Recommended minimum timed count duration: 1 hour. 39 | * 40 | * Generated from protobuf enum PERIOD_1_DAY = 3; 41 | */ 42 | const PERIOD_1_DAY = 3; 43 | /** 44 | * Retrieve data for the last week. 45 | * Recommended minimum timed count duration: 6 hours. 46 | * 47 | * Generated from protobuf enum PERIOD_1_WEEK = 4; 48 | */ 49 | const PERIOD_1_WEEK = 4; 50 | /** 51 | * Retrieve data for the last 30 days. 52 | * Recommended minimum timed count duration: 1 day. 53 | * 54 | * Generated from protobuf enum PERIOD_30_DAYS = 5; 55 | */ 56 | const PERIOD_30_DAYS = 5; 57 | 58 | private static $valueToName = [ 59 | self::PERIOD_UNSPECIFIED => 'PERIOD_UNSPECIFIED', 60 | self::PERIOD_1_HOUR => 'PERIOD_1_HOUR', 61 | self::PERIOD_6_HOURS => 'PERIOD_6_HOURS', 62 | self::PERIOD_1_DAY => 'PERIOD_1_DAY', 63 | self::PERIOD_1_WEEK => 'PERIOD_1_WEEK', 64 | self::PERIOD_30_DAYS => 'PERIOD_30_DAYS', 65 | ]; 66 | 67 | public static function name($value) 68 | { 69 | if (!isset(self::$valueToName[$value])) { 70 | throw new UnexpectedValueException(sprintf( 71 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 72 | } 73 | return self::$valueToName[$value]; 74 | } 75 | 76 | 77 | public static function value($name) 78 | { 79 | $const = __CLASS__ . '::' . strtoupper($name); 80 | if (!defined($const)) { 81 | throw new UnexpectedValueException(sprintf( 82 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 83 | } 84 | return constant($const); 85 | } 86 | } 87 | 88 | // Adding a class alias for backwards compatibility with the previous class name. 89 | class_alias(Period::class, \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange_Period::class); 90 | 91 | -------------------------------------------------------------------------------- /src/V1beta1/UpdateGroupRequest.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.UpdateGroupRequest 15 | */ 16 | class UpdateGroupRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The group which replaces the resource on the server. 20 | * 21 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroup group = 1 [(.google.api.field_behavior) = REQUIRED]; 22 | */ 23 | private $group = null; 24 | 25 | /** 26 | * @param \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $group Required. The group which replaces the resource on the server. 27 | * 28 | * @return \Google\Cloud\ErrorReporting\V1beta1\UpdateGroupRequest 29 | * 30 | * @experimental 31 | */ 32 | public static function build(\Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $group): self 33 | { 34 | return (new self()) 35 | ->setGroup($group); 36 | } 37 | 38 | /** 39 | * Constructor. 40 | * 41 | * @param array $data { 42 | * Optional. Data for populating the Message object. 43 | * 44 | * @type \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $group 45 | * Required. The group which replaces the resource on the server. 46 | * } 47 | */ 48 | public function __construct($data = NULL) { 49 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorGroupService::initOnce(); 50 | parent::__construct($data); 51 | } 52 | 53 | /** 54 | * Required. The group which replaces the resource on the server. 55 | * 56 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroup group = 1 [(.google.api.field_behavior) = REQUIRED]; 57 | * @return \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup|null 58 | */ 59 | public function getGroup() 60 | { 61 | return $this->group; 62 | } 63 | 64 | public function hasGroup() 65 | { 66 | return isset($this->group); 67 | } 68 | 69 | public function clearGroup() 70 | { 71 | unset($this->group); 72 | } 73 | 74 | /** 75 | * Required. The group which replaces the resource on the server. 76 | * 77 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorGroup group = 1 [(.google.api.field_behavior) = REQUIRED]; 78 | * @param \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $var 79 | * @return $this 80 | */ 81 | public function setGroup($var) 82 | { 83 | GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup::class); 84 | $this->group = $var; 85 | 86 | return $this; 87 | } 88 | 89 | } 90 | 91 | -------------------------------------------------------------------------------- /src/V1beta1/resources/error_stats_service_rest_client_config.php: -------------------------------------------------------------------------------- 1 | [ 25 | 'google.devtools.clouderrorreporting.v1beta1.ErrorStatsService' => [ 26 | 'DeleteEvents' => [ 27 | 'method' => 'delete', 28 | 'uriTemplate' => '/v1beta1/{project_name=projects/*}/events', 29 | 'additionalBindings' => [ 30 | [ 31 | 'method' => 'delete', 32 | 'uriTemplate' => '/v1beta1/{project_name=projects/*/locations/*}/events', 33 | ], 34 | ], 35 | 'placeholders' => [ 36 | 'project_name' => [ 37 | 'getters' => [ 38 | 'getProjectName', 39 | ], 40 | ], 41 | ], 42 | ], 43 | 'ListEvents' => [ 44 | 'method' => 'get', 45 | 'uriTemplate' => '/v1beta1/{project_name=projects/*}/events', 46 | 'additionalBindings' => [ 47 | [ 48 | 'method' => 'get', 49 | 'uriTemplate' => '/v1beta1/{project_name=projects/*/locations/*}/events', 50 | 'queryParams' => [ 51 | 'group_id', 52 | ], 53 | ], 54 | ], 55 | 'placeholders' => [ 56 | 'project_name' => [ 57 | 'getters' => [ 58 | 'getProjectName', 59 | ], 60 | ], 61 | ], 62 | 'queryParams' => [ 63 | 'group_id', 64 | ], 65 | ], 66 | 'ListGroupStats' => [ 67 | 'method' => 'get', 68 | 'uriTemplate' => '/v1beta1/{project_name=projects/*}/groupStats', 69 | 'additionalBindings' => [ 70 | [ 71 | 'method' => 'get', 72 | 'uriTemplate' => '/v1beta1/{project_name=projects/*/locations/*}/groupStats', 73 | ], 74 | ], 75 | 'placeholders' => [ 76 | 'project_name' => [ 77 | 'getters' => [ 78 | 'getProjectName', 79 | ], 80 | ], 81 | ], 82 | ], 83 | ], 84 | ], 85 | 'numericEnums' => true, 86 | ]; 87 | -------------------------------------------------------------------------------- /src/V1beta1/ErrorStatsServiceGrpcClient.php: -------------------------------------------------------------------------------- 1 | _simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/ListGroupStats', 46 | $argument, 47 | ['\Google\Cloud\ErrorReporting\V1beta1\ListGroupStatsResponse', 'decode'], 48 | $metadata, $options); 49 | } 50 | 51 | /** 52 | * Lists the specified events. 53 | * @param \Google\Cloud\ErrorReporting\V1beta1\ListEventsRequest $argument input argument 54 | * @param array $metadata metadata 55 | * @param array $options call options 56 | * @return \Grpc\UnaryCall 57 | */ 58 | public function ListEvents(\Google\Cloud\ErrorReporting\V1beta1\ListEventsRequest $argument, 59 | $metadata = [], $options = []) { 60 | return $this->_simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/ListEvents', 61 | $argument, 62 | ['\Google\Cloud\ErrorReporting\V1beta1\ListEventsResponse', 'decode'], 63 | $metadata, $options); 64 | } 65 | 66 | /** 67 | * Deletes all error events of a given project. 68 | * @param \Google\Cloud\ErrorReporting\V1beta1\DeleteEventsRequest $argument input argument 69 | * @param array $metadata metadata 70 | * @param array $options call options 71 | * @return \Grpc\UnaryCall 72 | */ 73 | public function DeleteEvents(\Google\Cloud\ErrorReporting\V1beta1\DeleteEventsRequest $argument, 74 | $metadata = [], $options = []) { 75 | return $this->_simpleRequest('/google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/DeleteEvents', 76 | $argument, 77 | ['\Google\Cloud\ErrorReporting\V1beta1\DeleteEventsResponse', 'decode'], 78 | $metadata, $options); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/V1beta1/resources/error_stats_service_descriptor_config.php: -------------------------------------------------------------------------------- 1 | [ 25 | 'google.devtools.clouderrorreporting.v1beta1.ErrorStatsService' => [ 26 | 'DeleteEvents' => [ 27 | 'callType' => \Google\ApiCore\Call::UNARY_CALL, 28 | 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\DeleteEventsResponse', 29 | 'headerParams' => [ 30 | [ 31 | 'keyName' => 'project_name', 32 | 'fieldAccessors' => [ 33 | 'getProjectName', 34 | ], 35 | ], 36 | ], 37 | ], 38 | 'ListEvents' => [ 39 | 'pageStreaming' => [ 40 | 'requestPageTokenGetMethod' => 'getPageToken', 41 | 'requestPageTokenSetMethod' => 'setPageToken', 42 | 'requestPageSizeGetMethod' => 'getPageSize', 43 | 'requestPageSizeSetMethod' => 'setPageSize', 44 | 'responsePageTokenGetMethod' => 'getNextPageToken', 45 | 'resourcesGetMethod' => 'getErrorEvents', 46 | ], 47 | 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, 48 | 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\ListEventsResponse', 49 | 'headerParams' => [ 50 | [ 51 | 'keyName' => 'project_name', 52 | 'fieldAccessors' => [ 53 | 'getProjectName', 54 | ], 55 | ], 56 | ], 57 | ], 58 | 'ListGroupStats' => [ 59 | 'pageStreaming' => [ 60 | 'requestPageTokenGetMethod' => 'getPageToken', 61 | 'requestPageTokenSetMethod' => 'setPageToken', 62 | 'requestPageSizeGetMethod' => 'getPageSize', 63 | 'requestPageSizeSetMethod' => 'setPageSize', 64 | 'responsePageTokenGetMethod' => 'getNextPageToken', 65 | 'resourcesGetMethod' => 'getErrorGroupStats', 66 | ], 67 | 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, 68 | 'responseType' => 'Google\Cloud\ErrorReporting\V1beta1\ListGroupStatsResponse', 69 | 'headerParams' => [ 70 | [ 71 | 'keyName' => 'project_name', 72 | 'fieldAccessors' => [ 73 | 'getProjectName', 74 | ], 75 | ], 76 | ], 77 | ], 78 | 'templateMap' => [ 79 | 'project' => 'projects/{project}', 80 | ], 81 | ], 82 | ], 83 | ]; 84 | -------------------------------------------------------------------------------- /src/V1beta1/TimedCount.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.TimedCount 17 | */ 18 | class TimedCount extends \Google\Protobuf\Internal\Message 19 | { 20 | /** 21 | * Approximate number of occurrences in the given time period. 22 | * 23 | * Generated from protobuf field int64 count = 1; 24 | */ 25 | private $count = 0; 26 | /** 27 | * Start of the time period to which `count` refers (included). 28 | * 29 | * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; 30 | */ 31 | private $start_time = null; 32 | /** 33 | * End of the time period to which `count` refers (excluded). 34 | * 35 | * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; 36 | */ 37 | private $end_time = null; 38 | 39 | /** 40 | * Constructor. 41 | * 42 | * @param array $data { 43 | * Optional. Data for populating the Message object. 44 | * 45 | * @type int|string $count 46 | * Approximate number of occurrences in the given time period. 47 | * @type \Google\Protobuf\Timestamp $start_time 48 | * Start of the time period to which `count` refers (included). 49 | * @type \Google\Protobuf\Timestamp $end_time 50 | * End of the time period to which `count` refers (excluded). 51 | * } 52 | */ 53 | public function __construct($data = NULL) { 54 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); 55 | parent::__construct($data); 56 | } 57 | 58 | /** 59 | * Approximate number of occurrences in the given time period. 60 | * 61 | * Generated from protobuf field int64 count = 1; 62 | * @return int|string 63 | */ 64 | public function getCount() 65 | { 66 | return $this->count; 67 | } 68 | 69 | /** 70 | * Approximate number of occurrences in the given time period. 71 | * 72 | * Generated from protobuf field int64 count = 1; 73 | * @param int|string $var 74 | * @return $this 75 | */ 76 | public function setCount($var) 77 | { 78 | GPBUtil::checkInt64($var); 79 | $this->count = $var; 80 | 81 | return $this; 82 | } 83 | 84 | /** 85 | * Start of the time period to which `count` refers (included). 86 | * 87 | * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; 88 | * @return \Google\Protobuf\Timestamp|null 89 | */ 90 | public function getStartTime() 91 | { 92 | return $this->start_time; 93 | } 94 | 95 | public function hasStartTime() 96 | { 97 | return isset($this->start_time); 98 | } 99 | 100 | public function clearStartTime() 101 | { 102 | unset($this->start_time); 103 | } 104 | 105 | /** 106 | * Start of the time period to which `count` refers (included). 107 | * 108 | * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; 109 | * @param \Google\Protobuf\Timestamp $var 110 | * @return $this 111 | */ 112 | public function setStartTime($var) 113 | { 114 | GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); 115 | $this->start_time = $var; 116 | 117 | return $this; 118 | } 119 | 120 | /** 121 | * End of the time period to which `count` refers (excluded). 122 | * 123 | * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; 124 | * @return \Google\Protobuf\Timestamp|null 125 | */ 126 | public function getEndTime() 127 | { 128 | return $this->end_time; 129 | } 130 | 131 | public function hasEndTime() 132 | { 133 | return isset($this->end_time); 134 | } 135 | 136 | public function clearEndTime() 137 | { 138 | unset($this->end_time); 139 | } 140 | 141 | /** 142 | * End of the time period to which `count` refers (excluded). 143 | * 144 | * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; 145 | * @param \Google\Protobuf\Timestamp $var 146 | * @return $this 147 | */ 148 | public function setEndTime($var) 149 | { 150 | GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); 151 | $this->end_time = $var; 152 | 153 | return $this; 154 | } 155 | 156 | } 157 | 158 | -------------------------------------------------------------------------------- /src/V1beta1/SourceLocation.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.SourceLocation 18 | */ 19 | class SourceLocation extends \Google\Protobuf\Internal\Message 20 | { 21 | /** 22 | * The source code filename, which can include a truncated relative 23 | * path, or a full path from a production machine. 24 | * 25 | * Generated from protobuf field string file_path = 1; 26 | */ 27 | private $file_path = ''; 28 | /** 29 | * 1-based. 0 indicates that the line number is unknown. 30 | * 31 | * Generated from protobuf field int32 line_number = 2; 32 | */ 33 | private $line_number = 0; 34 | /** 35 | * Human-readable name of a function or method. 36 | * The value can include optional context like the class or package name. 37 | * For example, `my.package.MyClass.method` in case of Java. 38 | * 39 | * Generated from protobuf field string function_name = 4; 40 | */ 41 | private $function_name = ''; 42 | 43 | /** 44 | * Constructor. 45 | * 46 | * @param array $data { 47 | * Optional. Data for populating the Message object. 48 | * 49 | * @type string $file_path 50 | * The source code filename, which can include a truncated relative 51 | * path, or a full path from a production machine. 52 | * @type int $line_number 53 | * 1-based. 0 indicates that the line number is unknown. 54 | * @type string $function_name 55 | * Human-readable name of a function or method. 56 | * The value can include optional context like the class or package name. 57 | * For example, `my.package.MyClass.method` in case of Java. 58 | * } 59 | */ 60 | public function __construct($data = NULL) { 61 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); 62 | parent::__construct($data); 63 | } 64 | 65 | /** 66 | * The source code filename, which can include a truncated relative 67 | * path, or a full path from a production machine. 68 | * 69 | * Generated from protobuf field string file_path = 1; 70 | * @return string 71 | */ 72 | public function getFilePath() 73 | { 74 | return $this->file_path; 75 | } 76 | 77 | /** 78 | * The source code filename, which can include a truncated relative 79 | * path, or a full path from a production machine. 80 | * 81 | * Generated from protobuf field string file_path = 1; 82 | * @param string $var 83 | * @return $this 84 | */ 85 | public function setFilePath($var) 86 | { 87 | GPBUtil::checkString($var, True); 88 | $this->file_path = $var; 89 | 90 | return $this; 91 | } 92 | 93 | /** 94 | * 1-based. 0 indicates that the line number is unknown. 95 | * 96 | * Generated from protobuf field int32 line_number = 2; 97 | * @return int 98 | */ 99 | public function getLineNumber() 100 | { 101 | return $this->line_number; 102 | } 103 | 104 | /** 105 | * 1-based. 0 indicates that the line number is unknown. 106 | * 107 | * Generated from protobuf field int32 line_number = 2; 108 | * @param int $var 109 | * @return $this 110 | */ 111 | public function setLineNumber($var) 112 | { 113 | GPBUtil::checkInt32($var); 114 | $this->line_number = $var; 115 | 116 | return $this; 117 | } 118 | 119 | /** 120 | * Human-readable name of a function or method. 121 | * The value can include optional context like the class or package name. 122 | * For example, `my.package.MyClass.method` in case of Java. 123 | * 124 | * Generated from protobuf field string function_name = 4; 125 | * @return string 126 | */ 127 | public function getFunctionName() 128 | { 129 | return $this->function_name; 130 | } 131 | 132 | /** 133 | * Human-readable name of a function or method. 134 | * The value can include optional context like the class or package name. 135 | * For example, `my.package.MyClass.method` in case of Java. 136 | * 137 | * Generated from protobuf field string function_name = 4; 138 | * @param string $var 139 | * @return $this 140 | */ 141 | public function setFunctionName($var) 142 | { 143 | GPBUtil::checkString($var, True); 144 | $this->function_name = $var; 145 | 146 | return $this; 147 | } 148 | 149 | } 150 | 151 | -------------------------------------------------------------------------------- /src/V1beta1/ListEventsResponse.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ListEventsResponse 15 | */ 16 | class ListEventsResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * The error events which match the given request. 20 | * 21 | * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorEvent error_events = 1; 22 | */ 23 | private $error_events; 24 | /** 25 | * If non-empty, more results are available. 26 | * Pass this token, along with the same query parameters as the first 27 | * request, to view the next page of results. 28 | * 29 | * Generated from protobuf field string next_page_token = 2; 30 | */ 31 | private $next_page_token = ''; 32 | /** 33 | * The timestamp specifies the start time to which the request was restricted. 34 | * 35 | * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; 36 | */ 37 | private $time_range_begin = null; 38 | 39 | /** 40 | * Constructor. 41 | * 42 | * @param array $data { 43 | * Optional. Data for populating the Message object. 44 | * 45 | * @type array<\Google\Cloud\ErrorReporting\V1beta1\ErrorEvent>|\Google\Protobuf\Internal\RepeatedField $error_events 46 | * The error events which match the given request. 47 | * @type string $next_page_token 48 | * If non-empty, more results are available. 49 | * Pass this token, along with the same query parameters as the first 50 | * request, to view the next page of results. 51 | * @type \Google\Protobuf\Timestamp $time_range_begin 52 | * The timestamp specifies the start time to which the request was restricted. 53 | * } 54 | */ 55 | public function __construct($data = NULL) { 56 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); 57 | parent::__construct($data); 58 | } 59 | 60 | /** 61 | * The error events which match the given request. 62 | * 63 | * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorEvent error_events = 1; 64 | * @return \Google\Protobuf\Internal\RepeatedField 65 | */ 66 | public function getErrorEvents() 67 | { 68 | return $this->error_events; 69 | } 70 | 71 | /** 72 | * The error events which match the given request. 73 | * 74 | * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorEvent error_events = 1; 75 | * @param array<\Google\Cloud\ErrorReporting\V1beta1\ErrorEvent>|\Google\Protobuf\Internal\RepeatedField $var 76 | * @return $this 77 | */ 78 | public function setErrorEvents($var) 79 | { 80 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent::class); 81 | $this->error_events = $arr; 82 | 83 | return $this; 84 | } 85 | 86 | /** 87 | * If non-empty, more results are available. 88 | * Pass this token, along with the same query parameters as the first 89 | * request, to view the next page of results. 90 | * 91 | * Generated from protobuf field string next_page_token = 2; 92 | * @return string 93 | */ 94 | public function getNextPageToken() 95 | { 96 | return $this->next_page_token; 97 | } 98 | 99 | /** 100 | * If non-empty, more results are available. 101 | * Pass this token, along with the same query parameters as the first 102 | * request, to view the next page of results. 103 | * 104 | * Generated from protobuf field string next_page_token = 2; 105 | * @param string $var 106 | * @return $this 107 | */ 108 | public function setNextPageToken($var) 109 | { 110 | GPBUtil::checkString($var, True); 111 | $this->next_page_token = $var; 112 | 113 | return $this; 114 | } 115 | 116 | /** 117 | * The timestamp specifies the start time to which the request was restricted. 118 | * 119 | * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; 120 | * @return \Google\Protobuf\Timestamp|null 121 | */ 122 | public function getTimeRangeBegin() 123 | { 124 | return $this->time_range_begin; 125 | } 126 | 127 | public function hasTimeRangeBegin() 128 | { 129 | return isset($this->time_range_begin); 130 | } 131 | 132 | public function clearTimeRangeBegin() 133 | { 134 | unset($this->time_range_begin); 135 | } 136 | 137 | /** 138 | * The timestamp specifies the start time to which the request was restricted. 139 | * 140 | * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; 141 | * @param \Google\Protobuf\Timestamp $var 142 | * @return $this 143 | */ 144 | public function setTimeRangeBegin($var) 145 | { 146 | GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); 147 | $this->time_range_begin = $var; 148 | 149 | return $this; 150 | } 151 | 152 | } 153 | 154 | -------------------------------------------------------------------------------- /src/V1beta1/DeleteEventsRequest.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest 15 | */ 16 | class DeleteEventsRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The resource name of the Google Cloud Platform project. Written 20 | * as `projects/{projectID}` or `projects/{projectID}/locations/{location}`, 21 | * where `{projectID}` is the [Google Cloud Platform project 22 | * ID](https://support.google.com/cloud/answer/6158840) and `{location}` is 23 | * a Cloud region. 24 | * Examples: `projects/my-project-123`, 25 | * `projects/my-project-123/locations/global`. 26 | * For a list of supported locations, see [Supported 27 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 28 | * the default when unspecified. 29 | * 30 | * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 31 | */ 32 | private $project_name = ''; 33 | 34 | /** 35 | * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written 36 | * as `projects/{projectID}` or `projects/{projectID}/locations/{location}`, 37 | * where `{projectID}` is the [Google Cloud Platform project 38 | * ID](https://support.google.com/cloud/answer/6158840) and `{location}` is 39 | * a Cloud region. 40 | * 41 | * Examples: `projects/my-project-123`, 42 | * `projects/my-project-123/locations/global`. 43 | * 44 | * For a list of supported locations, see [Supported 45 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 46 | * the default when unspecified. Please see 47 | * {@see ErrorStatsServiceClient::projectName()} for help formatting this field. 48 | * 49 | * @return \Google\Cloud\ErrorReporting\V1beta1\DeleteEventsRequest 50 | * 51 | * @experimental 52 | */ 53 | public static function build(string $projectName): self 54 | { 55 | return (new self()) 56 | ->setProjectName($projectName); 57 | } 58 | 59 | /** 60 | * Constructor. 61 | * 62 | * @param array $data { 63 | * Optional. Data for populating the Message object. 64 | * 65 | * @type string $project_name 66 | * Required. The resource name of the Google Cloud Platform project. Written 67 | * as `projects/{projectID}` or `projects/{projectID}/locations/{location}`, 68 | * where `{projectID}` is the [Google Cloud Platform project 69 | * ID](https://support.google.com/cloud/answer/6158840) and `{location}` is 70 | * a Cloud region. 71 | * Examples: `projects/my-project-123`, 72 | * `projects/my-project-123/locations/global`. 73 | * For a list of supported locations, see [Supported 74 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 75 | * the default when unspecified. 76 | * } 77 | */ 78 | public function __construct($data = NULL) { 79 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); 80 | parent::__construct($data); 81 | } 82 | 83 | /** 84 | * Required. The resource name of the Google Cloud Platform project. Written 85 | * as `projects/{projectID}` or `projects/{projectID}/locations/{location}`, 86 | * where `{projectID}` is the [Google Cloud Platform project 87 | * ID](https://support.google.com/cloud/answer/6158840) and `{location}` is 88 | * a Cloud region. 89 | * Examples: `projects/my-project-123`, 90 | * `projects/my-project-123/locations/global`. 91 | * For a list of supported locations, see [Supported 92 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 93 | * the default when unspecified. 94 | * 95 | * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 96 | * @return string 97 | */ 98 | public function getProjectName() 99 | { 100 | return $this->project_name; 101 | } 102 | 103 | /** 104 | * Required. The resource name of the Google Cloud Platform project. Written 105 | * as `projects/{projectID}` or `projects/{projectID}/locations/{location}`, 106 | * where `{projectID}` is the [Google Cloud Platform project 107 | * ID](https://support.google.com/cloud/answer/6158840) and `{location}` is 108 | * a Cloud region. 109 | * Examples: `projects/my-project-123`, 110 | * `projects/my-project-123/locations/global`. 111 | * For a list of supported locations, see [Supported 112 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 113 | * the default when unspecified. 114 | * 115 | * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 116 | * @param string $var 117 | * @return $this 118 | */ 119 | public function setProjectName($var) 120 | { 121 | GPBUtil::checkString($var, True); 122 | $this->project_name = $var; 123 | 124 | return $this; 125 | } 126 | 127 | } 128 | 129 | -------------------------------------------------------------------------------- /src/V1beta1/ServiceContextFilter.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ServiceContextFilter 18 | */ 19 | class ServiceContextFilter extends \Google\Protobuf\Internal\Message 20 | { 21 | /** 22 | * Optional. The exact value to match against 23 | * [`ServiceContext.service`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service). 24 | * 25 | * Generated from protobuf field string service = 2 [(.google.api.field_behavior) = OPTIONAL]; 26 | */ 27 | private $service = ''; 28 | /** 29 | * Optional. The exact value to match against 30 | * [`ServiceContext.version`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version). 31 | * 32 | * Generated from protobuf field string version = 3 [(.google.api.field_behavior) = OPTIONAL]; 33 | */ 34 | private $version = ''; 35 | /** 36 | * Optional. The exact value to match against 37 | * [`ServiceContext.resource_type`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type). 38 | * 39 | * Generated from protobuf field string resource_type = 4 [(.google.api.field_behavior) = OPTIONAL]; 40 | */ 41 | private $resource_type = ''; 42 | 43 | /** 44 | * Constructor. 45 | * 46 | * @param array $data { 47 | * Optional. Data for populating the Message object. 48 | * 49 | * @type string $service 50 | * Optional. The exact value to match against 51 | * [`ServiceContext.service`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service). 52 | * @type string $version 53 | * Optional. The exact value to match against 54 | * [`ServiceContext.version`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version). 55 | * @type string $resource_type 56 | * Optional. The exact value to match against 57 | * [`ServiceContext.resource_type`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type). 58 | * } 59 | */ 60 | public function __construct($data = NULL) { 61 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); 62 | parent::__construct($data); 63 | } 64 | 65 | /** 66 | * Optional. The exact value to match against 67 | * [`ServiceContext.service`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service). 68 | * 69 | * Generated from protobuf field string service = 2 [(.google.api.field_behavior) = OPTIONAL]; 70 | * @return string 71 | */ 72 | public function getService() 73 | { 74 | return $this->service; 75 | } 76 | 77 | /** 78 | * Optional. The exact value to match against 79 | * [`ServiceContext.service`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service). 80 | * 81 | * Generated from protobuf field string service = 2 [(.google.api.field_behavior) = OPTIONAL]; 82 | * @param string $var 83 | * @return $this 84 | */ 85 | public function setService($var) 86 | { 87 | GPBUtil::checkString($var, True); 88 | $this->service = $var; 89 | 90 | return $this; 91 | } 92 | 93 | /** 94 | * Optional. The exact value to match against 95 | * [`ServiceContext.version`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version). 96 | * 97 | * Generated from protobuf field string version = 3 [(.google.api.field_behavior) = OPTIONAL]; 98 | * @return string 99 | */ 100 | public function getVersion() 101 | { 102 | return $this->version; 103 | } 104 | 105 | /** 106 | * Optional. The exact value to match against 107 | * [`ServiceContext.version`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version). 108 | * 109 | * Generated from protobuf field string version = 3 [(.google.api.field_behavior) = OPTIONAL]; 110 | * @param string $var 111 | * @return $this 112 | */ 113 | public function setVersion($var) 114 | { 115 | GPBUtil::checkString($var, True); 116 | $this->version = $var; 117 | 118 | return $this; 119 | } 120 | 121 | /** 122 | * Optional. The exact value to match against 123 | * [`ServiceContext.resource_type`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type). 124 | * 125 | * Generated from protobuf field string resource_type = 4 [(.google.api.field_behavior) = OPTIONAL]; 126 | * @return string 127 | */ 128 | public function getResourceType() 129 | { 130 | return $this->resource_type; 131 | } 132 | 133 | /** 134 | * Optional. The exact value to match against 135 | * [`ServiceContext.resource_type`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type). 136 | * 137 | * Generated from protobuf field string resource_type = 4 [(.google.api.field_behavior) = OPTIONAL]; 138 | * @param string $var 139 | * @return $this 140 | */ 141 | public function setResourceType($var) 142 | { 143 | GPBUtil::checkString($var, True); 144 | $this->resource_type = $var; 145 | 146 | return $this; 147 | } 148 | 149 | } 150 | 151 | -------------------------------------------------------------------------------- /src/V1beta1/ReportErrorEventRequest.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest 15 | */ 16 | class ReportErrorEventRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The resource name of the Google Cloud Platform project. Written 20 | * as `projects/{projectId}`, where `{projectId}` is the 21 | * [Google Cloud Platform project 22 | * ID](https://support.google.com/cloud/answer/6158840). 23 | * Example: // `projects/my-project-123`. 24 | * 25 | * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 26 | */ 27 | private $project_name = ''; 28 | /** 29 | * Required. The error event to be reported. 30 | * 31 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2 [(.google.api.field_behavior) = REQUIRED]; 32 | */ 33 | private $event = null; 34 | 35 | /** 36 | * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written 37 | * as `projects/{projectId}`, where `{projectId}` is the 38 | * [Google Cloud Platform project 39 | * ID](https://support.google.com/cloud/answer/6158840). 40 | * 41 | * Example: // `projects/my-project-123`. Please see 42 | * {@see ReportErrorsServiceClient::projectName()} for help formatting this field. 43 | * @param \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent $event Required. The error event to be reported. 44 | * 45 | * @return \Google\Cloud\ErrorReporting\V1beta1\ReportErrorEventRequest 46 | * 47 | * @experimental 48 | */ 49 | public static function build(string $projectName, \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent $event): self 50 | { 51 | return (new self()) 52 | ->setProjectName($projectName) 53 | ->setEvent($event); 54 | } 55 | 56 | /** 57 | * Constructor. 58 | * 59 | * @param array $data { 60 | * Optional. Data for populating the Message object. 61 | * 62 | * @type string $project_name 63 | * Required. The resource name of the Google Cloud Platform project. Written 64 | * as `projects/{projectId}`, where `{projectId}` is the 65 | * [Google Cloud Platform project 66 | * ID](https://support.google.com/cloud/answer/6158840). 67 | * Example: // `projects/my-project-123`. 68 | * @type \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent $event 69 | * Required. The error event to be reported. 70 | * } 71 | */ 72 | public function __construct($data = NULL) { 73 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ReportErrorsService::initOnce(); 74 | parent::__construct($data); 75 | } 76 | 77 | /** 78 | * Required. The resource name of the Google Cloud Platform project. Written 79 | * as `projects/{projectId}`, where `{projectId}` is the 80 | * [Google Cloud Platform project 81 | * ID](https://support.google.com/cloud/answer/6158840). 82 | * Example: // `projects/my-project-123`. 83 | * 84 | * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 85 | * @return string 86 | */ 87 | public function getProjectName() 88 | { 89 | return $this->project_name; 90 | } 91 | 92 | /** 93 | * Required. The resource name of the Google Cloud Platform project. Written 94 | * as `projects/{projectId}`, where `{projectId}` is the 95 | * [Google Cloud Platform project 96 | * ID](https://support.google.com/cloud/answer/6158840). 97 | * Example: // `projects/my-project-123`. 98 | * 99 | * Generated from protobuf field string project_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 100 | * @param string $var 101 | * @return $this 102 | */ 103 | public function setProjectName($var) 104 | { 105 | GPBUtil::checkString($var, True); 106 | $this->project_name = $var; 107 | 108 | return $this; 109 | } 110 | 111 | /** 112 | * Required. The error event to be reported. 113 | * 114 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2 [(.google.api.field_behavior) = REQUIRED]; 115 | * @return \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent|null 116 | */ 117 | public function getEvent() 118 | { 119 | return $this->event; 120 | } 121 | 122 | public function hasEvent() 123 | { 124 | return isset($this->event); 125 | } 126 | 127 | public function clearEvent() 128 | { 129 | unset($this->event); 130 | } 131 | 132 | /** 133 | * Required. The error event to be reported. 134 | * 135 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2 [(.google.api.field_behavior) = REQUIRED]; 136 | * @param \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent $var 137 | * @return $this 138 | */ 139 | public function setEvent($var) 140 | { 141 | GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ReportedErrorEvent::class); 142 | $this->event = $var; 143 | 144 | return $this; 145 | } 146 | 147 | } 148 | 149 | -------------------------------------------------------------------------------- /src/V1beta1/ListGroupStatsResponse.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ListGroupStatsResponse 15 | */ 16 | class ListGroupStatsResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * The error group stats which match the given request. 20 | * 21 | * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorGroupStats error_group_stats = 1; 22 | */ 23 | private $error_group_stats; 24 | /** 25 | * If non-empty, more results are available. 26 | * Pass this token, along with the same query parameters as the first 27 | * request, to view the next page of results. 28 | * 29 | * Generated from protobuf field string next_page_token = 2; 30 | */ 31 | private $next_page_token = ''; 32 | /** 33 | * The timestamp specifies the start time to which the request was restricted. 34 | * The start time is set based on the requested time range. It may be adjusted 35 | * to a later time if a project has exceeded the storage quota and older data 36 | * has been deleted. 37 | * 38 | * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; 39 | */ 40 | private $time_range_begin = null; 41 | 42 | /** 43 | * Constructor. 44 | * 45 | * @param array $data { 46 | * Optional. Data for populating the Message object. 47 | * 48 | * @type array<\Google\Cloud\ErrorReporting\V1beta1\ErrorGroupStats>|\Google\Protobuf\Internal\RepeatedField $error_group_stats 49 | * The error group stats which match the given request. 50 | * @type string $next_page_token 51 | * If non-empty, more results are available. 52 | * Pass this token, along with the same query parameters as the first 53 | * request, to view the next page of results. 54 | * @type \Google\Protobuf\Timestamp $time_range_begin 55 | * The timestamp specifies the start time to which the request was restricted. 56 | * The start time is set based on the requested time range. It may be adjusted 57 | * to a later time if a project has exceeded the storage quota and older data 58 | * has been deleted. 59 | * } 60 | */ 61 | public function __construct($data = NULL) { 62 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorStatsService::initOnce(); 63 | parent::__construct($data); 64 | } 65 | 66 | /** 67 | * The error group stats which match the given request. 68 | * 69 | * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorGroupStats error_group_stats = 1; 70 | * @return \Google\Protobuf\Internal\RepeatedField 71 | */ 72 | public function getErrorGroupStats() 73 | { 74 | return $this->error_group_stats; 75 | } 76 | 77 | /** 78 | * The error group stats which match the given request. 79 | * 80 | * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.ErrorGroupStats error_group_stats = 1; 81 | * @param array<\Google\Cloud\ErrorReporting\V1beta1\ErrorGroupStats>|\Google\Protobuf\Internal\RepeatedField $var 82 | * @return $this 83 | */ 84 | public function setErrorGroupStats($var) 85 | { 86 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\ErrorGroupStats::class); 87 | $this->error_group_stats = $arr; 88 | 89 | return $this; 90 | } 91 | 92 | /** 93 | * If non-empty, more results are available. 94 | * Pass this token, along with the same query parameters as the first 95 | * request, to view the next page of results. 96 | * 97 | * Generated from protobuf field string next_page_token = 2; 98 | * @return string 99 | */ 100 | public function getNextPageToken() 101 | { 102 | return $this->next_page_token; 103 | } 104 | 105 | /** 106 | * If non-empty, more results are available. 107 | * Pass this token, along with the same query parameters as the first 108 | * request, to view the next page of results. 109 | * 110 | * Generated from protobuf field string next_page_token = 2; 111 | * @param string $var 112 | * @return $this 113 | */ 114 | public function setNextPageToken($var) 115 | { 116 | GPBUtil::checkString($var, True); 117 | $this->next_page_token = $var; 118 | 119 | return $this; 120 | } 121 | 122 | /** 123 | * The timestamp specifies the start time to which the request was restricted. 124 | * The start time is set based on the requested time range. It may be adjusted 125 | * to a later time if a project has exceeded the storage quota and older data 126 | * has been deleted. 127 | * 128 | * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; 129 | * @return \Google\Protobuf\Timestamp|null 130 | */ 131 | public function getTimeRangeBegin() 132 | { 133 | return $this->time_range_begin; 134 | } 135 | 136 | public function hasTimeRangeBegin() 137 | { 138 | return isset($this->time_range_begin); 139 | } 140 | 141 | public function clearTimeRangeBegin() 142 | { 143 | unset($this->time_range_begin); 144 | } 145 | 146 | /** 147 | * The timestamp specifies the start time to which the request was restricted. 148 | * The start time is set based on the requested time range. It may be adjusted 149 | * to a later time if a project has exceeded the storage quota and older data 150 | * has been deleted. 151 | * 152 | * Generated from protobuf field .google.protobuf.Timestamp time_range_begin = 4; 153 | * @param \Google\Protobuf\Timestamp $var 154 | * @return $this 155 | */ 156 | public function setTimeRangeBegin($var) 157 | { 158 | GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); 159 | $this->time_range_begin = $var; 160 | 161 | return $this; 162 | } 163 | 164 | } 165 | 166 | -------------------------------------------------------------------------------- /src/V1beta1/ErrorEvent.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ErrorEvent 15 | */ 16 | class ErrorEvent extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Time when the event occurred as provided in the error report. 20 | * If the report did not contain a timestamp, the time the error was received 21 | * by the Error Reporting system is used. 22 | * 23 | * Generated from protobuf field .google.protobuf.Timestamp event_time = 1; 24 | */ 25 | private $event_time = null; 26 | /** 27 | * The `ServiceContext` for which this error was reported. 28 | * 29 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2; 30 | */ 31 | private $service_context = null; 32 | /** 33 | * The stack trace that was reported or logged by the service. 34 | * 35 | * Generated from protobuf field string message = 3; 36 | */ 37 | private $message = ''; 38 | /** 39 | * Data about the context in which the error occurred. 40 | * 41 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 5; 42 | */ 43 | private $context = null; 44 | 45 | /** 46 | * Constructor. 47 | * 48 | * @param array $data { 49 | * Optional. Data for populating the Message object. 50 | * 51 | * @type \Google\Protobuf\Timestamp $event_time 52 | * Time when the event occurred as provided in the error report. 53 | * If the report did not contain a timestamp, the time the error was received 54 | * by the Error Reporting system is used. 55 | * @type \Google\Cloud\ErrorReporting\V1beta1\ServiceContext $service_context 56 | * The `ServiceContext` for which this error was reported. 57 | * @type string $message 58 | * The stack trace that was reported or logged by the service. 59 | * @type \Google\Cloud\ErrorReporting\V1beta1\ErrorContext $context 60 | * Data about the context in which the error occurred. 61 | * } 62 | */ 63 | public function __construct($data = NULL) { 64 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); 65 | parent::__construct($data); 66 | } 67 | 68 | /** 69 | * Time when the event occurred as provided in the error report. 70 | * If the report did not contain a timestamp, the time the error was received 71 | * by the Error Reporting system is used. 72 | * 73 | * Generated from protobuf field .google.protobuf.Timestamp event_time = 1; 74 | * @return \Google\Protobuf\Timestamp|null 75 | */ 76 | public function getEventTime() 77 | { 78 | return $this->event_time; 79 | } 80 | 81 | public function hasEventTime() 82 | { 83 | return isset($this->event_time); 84 | } 85 | 86 | public function clearEventTime() 87 | { 88 | unset($this->event_time); 89 | } 90 | 91 | /** 92 | * Time when the event occurred as provided in the error report. 93 | * If the report did not contain a timestamp, the time the error was received 94 | * by the Error Reporting system is used. 95 | * 96 | * Generated from protobuf field .google.protobuf.Timestamp event_time = 1; 97 | * @param \Google\Protobuf\Timestamp $var 98 | * @return $this 99 | */ 100 | public function setEventTime($var) 101 | { 102 | GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); 103 | $this->event_time = $var; 104 | 105 | return $this; 106 | } 107 | 108 | /** 109 | * The `ServiceContext` for which this error was reported. 110 | * 111 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2; 112 | * @return \Google\Cloud\ErrorReporting\V1beta1\ServiceContext|null 113 | */ 114 | public function getServiceContext() 115 | { 116 | return $this->service_context; 117 | } 118 | 119 | public function hasServiceContext() 120 | { 121 | return isset($this->service_context); 122 | } 123 | 124 | public function clearServiceContext() 125 | { 126 | unset($this->service_context); 127 | } 128 | 129 | /** 130 | * The `ServiceContext` for which this error was reported. 131 | * 132 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2; 133 | * @param \Google\Cloud\ErrorReporting\V1beta1\ServiceContext $var 134 | * @return $this 135 | */ 136 | public function setServiceContext($var) 137 | { 138 | GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ServiceContext::class); 139 | $this->service_context = $var; 140 | 141 | return $this; 142 | } 143 | 144 | /** 145 | * The stack trace that was reported or logged by the service. 146 | * 147 | * Generated from protobuf field string message = 3; 148 | * @return string 149 | */ 150 | public function getMessage() 151 | { 152 | return $this->message; 153 | } 154 | 155 | /** 156 | * The stack trace that was reported or logged by the service. 157 | * 158 | * Generated from protobuf field string message = 3; 159 | * @param string $var 160 | * @return $this 161 | */ 162 | public function setMessage($var) 163 | { 164 | GPBUtil::checkString($var, True); 165 | $this->message = $var; 166 | 167 | return $this; 168 | } 169 | 170 | /** 171 | * Data about the context in which the error occurred. 172 | * 173 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 5; 174 | * @return \Google\Cloud\ErrorReporting\V1beta1\ErrorContext|null 175 | */ 176 | public function getContext() 177 | { 178 | return $this->context; 179 | } 180 | 181 | public function hasContext() 182 | { 183 | return isset($this->context); 184 | } 185 | 186 | public function clearContext() 187 | { 188 | unset($this->context); 189 | } 190 | 191 | /** 192 | * Data about the context in which the error occurred. 193 | * 194 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 5; 195 | * @param \Google\Cloud\ErrorReporting\V1beta1\ErrorContext $var 196 | * @return $this 197 | */ 198 | public function setContext($var) 199 | { 200 | GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorContext::class); 201 | $this->context = $var; 202 | 203 | return $this; 204 | } 205 | 206 | } 207 | 208 | -------------------------------------------------------------------------------- /src/V1beta1/ServiceContext.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ServiceContext 16 | */ 17 | class ServiceContext extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * An identifier of the service, such as the name of the 21 | * executable, job, or Google App Engine service name. This field is expected 22 | * to have a low number of values that are relatively stable over time, as 23 | * opposed to `version`, which can be changed whenever new code is deployed. 24 | * Contains the service name for error reports extracted from Google 25 | * App Engine logs or `default` if the App Engine default service is used. 26 | * 27 | * Generated from protobuf field string service = 2; 28 | */ 29 | private $service = ''; 30 | /** 31 | * Represents the source code version that the developer provided, 32 | * which could represent a version label or a Git SHA-1 hash, for example. 33 | * For App Engine standard environment, the version is set to the version of 34 | * the app. 35 | * 36 | * Generated from protobuf field string version = 3; 37 | */ 38 | private $version = ''; 39 | /** 40 | * Type of the MonitoredResource. List of possible values: 41 | * https://cloud.google.com/monitoring/api/resources 42 | * Value is set automatically for incoming errors and must not be set when 43 | * reporting errors. 44 | * 45 | * Generated from protobuf field string resource_type = 4; 46 | */ 47 | private $resource_type = ''; 48 | 49 | /** 50 | * Constructor. 51 | * 52 | * @param array $data { 53 | * Optional. Data for populating the Message object. 54 | * 55 | * @type string $service 56 | * An identifier of the service, such as the name of the 57 | * executable, job, or Google App Engine service name. This field is expected 58 | * to have a low number of values that are relatively stable over time, as 59 | * opposed to `version`, which can be changed whenever new code is deployed. 60 | * Contains the service name for error reports extracted from Google 61 | * App Engine logs or `default` if the App Engine default service is used. 62 | * @type string $version 63 | * Represents the source code version that the developer provided, 64 | * which could represent a version label or a Git SHA-1 hash, for example. 65 | * For App Engine standard environment, the version is set to the version of 66 | * the app. 67 | * @type string $resource_type 68 | * Type of the MonitoredResource. List of possible values: 69 | * https://cloud.google.com/monitoring/api/resources 70 | * Value is set automatically for incoming errors and must not be set when 71 | * reporting errors. 72 | * } 73 | */ 74 | public function __construct($data = NULL) { 75 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); 76 | parent::__construct($data); 77 | } 78 | 79 | /** 80 | * An identifier of the service, such as the name of the 81 | * executable, job, or Google App Engine service name. This field is expected 82 | * to have a low number of values that are relatively stable over time, as 83 | * opposed to `version`, which can be changed whenever new code is deployed. 84 | * Contains the service name for error reports extracted from Google 85 | * App Engine logs or `default` if the App Engine default service is used. 86 | * 87 | * Generated from protobuf field string service = 2; 88 | * @return string 89 | */ 90 | public function getService() 91 | { 92 | return $this->service; 93 | } 94 | 95 | /** 96 | * An identifier of the service, such as the name of the 97 | * executable, job, or Google App Engine service name. This field is expected 98 | * to have a low number of values that are relatively stable over time, as 99 | * opposed to `version`, which can be changed whenever new code is deployed. 100 | * Contains the service name for error reports extracted from Google 101 | * App Engine logs or `default` if the App Engine default service is used. 102 | * 103 | * Generated from protobuf field string service = 2; 104 | * @param string $var 105 | * @return $this 106 | */ 107 | public function setService($var) 108 | { 109 | GPBUtil::checkString($var, True); 110 | $this->service = $var; 111 | 112 | return $this; 113 | } 114 | 115 | /** 116 | * Represents the source code version that the developer provided, 117 | * which could represent a version label or a Git SHA-1 hash, for example. 118 | * For App Engine standard environment, the version is set to the version of 119 | * the app. 120 | * 121 | * Generated from protobuf field string version = 3; 122 | * @return string 123 | */ 124 | public function getVersion() 125 | { 126 | return $this->version; 127 | } 128 | 129 | /** 130 | * Represents the source code version that the developer provided, 131 | * which could represent a version label or a Git SHA-1 hash, for example. 132 | * For App Engine standard environment, the version is set to the version of 133 | * the app. 134 | * 135 | * Generated from protobuf field string version = 3; 136 | * @param string $var 137 | * @return $this 138 | */ 139 | public function setVersion($var) 140 | { 141 | GPBUtil::checkString($var, True); 142 | $this->version = $var; 143 | 144 | return $this; 145 | } 146 | 147 | /** 148 | * Type of the MonitoredResource. List of possible values: 149 | * https://cloud.google.com/monitoring/api/resources 150 | * Value is set automatically for incoming errors and must not be set when 151 | * reporting errors. 152 | * 153 | * Generated from protobuf field string resource_type = 4; 154 | * @return string 155 | */ 156 | public function getResourceType() 157 | { 158 | return $this->resource_type; 159 | } 160 | 161 | /** 162 | * Type of the MonitoredResource. List of possible values: 163 | * https://cloud.google.com/monitoring/api/resources 164 | * Value is set automatically for incoming errors and must not be set when 165 | * reporting errors. 166 | * 167 | * Generated from protobuf field string resource_type = 4; 168 | * @param string $var 169 | * @return $this 170 | */ 171 | public function setResourceType($var) 172 | { 173 | GPBUtil::checkString($var, True); 174 | $this->resource_type = $var; 175 | 176 | return $this; 177 | } 178 | 179 | } 180 | 181 | -------------------------------------------------------------------------------- /src/V1beta1/HttpRequestContext.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.HttpRequestContext 18 | */ 19 | class HttpRequestContext extends \Google\Protobuf\Internal\Message 20 | { 21 | /** 22 | * The type of HTTP request, such as `GET`, `POST`, etc. 23 | * 24 | * Generated from protobuf field string method = 1; 25 | */ 26 | private $method = ''; 27 | /** 28 | * The URL of the request. 29 | * 30 | * Generated from protobuf field string url = 2; 31 | */ 32 | private $url = ''; 33 | /** 34 | * The user agent information that is provided with the request. 35 | * 36 | * Generated from protobuf field string user_agent = 3; 37 | */ 38 | private $user_agent = ''; 39 | /** 40 | * The referrer information that is provided with the request. 41 | * 42 | * Generated from protobuf field string referrer = 4; 43 | */ 44 | private $referrer = ''; 45 | /** 46 | * The HTTP response status code for the request. 47 | * 48 | * Generated from protobuf field int32 response_status_code = 5; 49 | */ 50 | private $response_status_code = 0; 51 | /** 52 | * The IP address from which the request originated. 53 | * This can be IPv4, IPv6, or a token which is derived from the 54 | * IP address, depending on the data that has been provided 55 | * in the error report. 56 | * 57 | * Generated from protobuf field string remote_ip = 6; 58 | */ 59 | private $remote_ip = ''; 60 | 61 | /** 62 | * Constructor. 63 | * 64 | * @param array $data { 65 | * Optional. Data for populating the Message object. 66 | * 67 | * @type string $method 68 | * The type of HTTP request, such as `GET`, `POST`, etc. 69 | * @type string $url 70 | * The URL of the request. 71 | * @type string $user_agent 72 | * The user agent information that is provided with the request. 73 | * @type string $referrer 74 | * The referrer information that is provided with the request. 75 | * @type int $response_status_code 76 | * The HTTP response status code for the request. 77 | * @type string $remote_ip 78 | * The IP address from which the request originated. 79 | * This can be IPv4, IPv6, or a token which is derived from the 80 | * IP address, depending on the data that has been provided 81 | * in the error report. 82 | * } 83 | */ 84 | public function __construct($data = NULL) { 85 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); 86 | parent::__construct($data); 87 | } 88 | 89 | /** 90 | * The type of HTTP request, such as `GET`, `POST`, etc. 91 | * 92 | * Generated from protobuf field string method = 1; 93 | * @return string 94 | */ 95 | public function getMethod() 96 | { 97 | return $this->method; 98 | } 99 | 100 | /** 101 | * The type of HTTP request, such as `GET`, `POST`, etc. 102 | * 103 | * Generated from protobuf field string method = 1; 104 | * @param string $var 105 | * @return $this 106 | */ 107 | public function setMethod($var) 108 | { 109 | GPBUtil::checkString($var, True); 110 | $this->method = $var; 111 | 112 | return $this; 113 | } 114 | 115 | /** 116 | * The URL of the request. 117 | * 118 | * Generated from protobuf field string url = 2; 119 | * @return string 120 | */ 121 | public function getUrl() 122 | { 123 | return $this->url; 124 | } 125 | 126 | /** 127 | * The URL of the request. 128 | * 129 | * Generated from protobuf field string url = 2; 130 | * @param string $var 131 | * @return $this 132 | */ 133 | public function setUrl($var) 134 | { 135 | GPBUtil::checkString($var, True); 136 | $this->url = $var; 137 | 138 | return $this; 139 | } 140 | 141 | /** 142 | * The user agent information that is provided with the request. 143 | * 144 | * Generated from protobuf field string user_agent = 3; 145 | * @return string 146 | */ 147 | public function getUserAgent() 148 | { 149 | return $this->user_agent; 150 | } 151 | 152 | /** 153 | * The user agent information that is provided with the request. 154 | * 155 | * Generated from protobuf field string user_agent = 3; 156 | * @param string $var 157 | * @return $this 158 | */ 159 | public function setUserAgent($var) 160 | { 161 | GPBUtil::checkString($var, True); 162 | $this->user_agent = $var; 163 | 164 | return $this; 165 | } 166 | 167 | /** 168 | * The referrer information that is provided with the request. 169 | * 170 | * Generated from protobuf field string referrer = 4; 171 | * @return string 172 | */ 173 | public function getReferrer() 174 | { 175 | return $this->referrer; 176 | } 177 | 178 | /** 179 | * The referrer information that is provided with the request. 180 | * 181 | * Generated from protobuf field string referrer = 4; 182 | * @param string $var 183 | * @return $this 184 | */ 185 | public function setReferrer($var) 186 | { 187 | GPBUtil::checkString($var, True); 188 | $this->referrer = $var; 189 | 190 | return $this; 191 | } 192 | 193 | /** 194 | * The HTTP response status code for the request. 195 | * 196 | * Generated from protobuf field int32 response_status_code = 5; 197 | * @return int 198 | */ 199 | public function getResponseStatusCode() 200 | { 201 | return $this->response_status_code; 202 | } 203 | 204 | /** 205 | * The HTTP response status code for the request. 206 | * 207 | * Generated from protobuf field int32 response_status_code = 5; 208 | * @param int $var 209 | * @return $this 210 | */ 211 | public function setResponseStatusCode($var) 212 | { 213 | GPBUtil::checkInt32($var); 214 | $this->response_status_code = $var; 215 | 216 | return $this; 217 | } 218 | 219 | /** 220 | * The IP address from which the request originated. 221 | * This can be IPv4, IPv6, or a token which is derived from the 222 | * IP address, depending on the data that has been provided 223 | * in the error report. 224 | * 225 | * Generated from protobuf field string remote_ip = 6; 226 | * @return string 227 | */ 228 | public function getRemoteIp() 229 | { 230 | return $this->remote_ip; 231 | } 232 | 233 | /** 234 | * The IP address from which the request originated. 235 | * This can be IPv4, IPv6, or a token which is derived from the 236 | * IP address, depending on the data that has been provided 237 | * in the error report. 238 | * 239 | * Generated from protobuf field string remote_ip = 6; 240 | * @param string $var 241 | * @return $this 242 | */ 243 | public function setRemoteIp($var) 244 | { 245 | GPBUtil::checkString($var, True); 246 | $this->remote_ip = $var; 247 | 248 | return $this; 249 | } 250 | 251 | } 252 | 253 | -------------------------------------------------------------------------------- /src/V1beta1/ErrorContext.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ErrorContext 18 | */ 19 | class ErrorContext extends \Google\Protobuf\Internal\Message 20 | { 21 | /** 22 | * The HTTP request which was processed when the error was 23 | * triggered. 24 | * 25 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1; 26 | */ 27 | private $http_request = null; 28 | /** 29 | * The user who caused or was affected by the crash. 30 | * This can be a user ID, an email address, or an arbitrary token that 31 | * uniquely identifies the user. 32 | * When sending an error report, leave this field empty if the user was not 33 | * logged in. In this case the 34 | * Error Reporting system will use other data, such as remote IP address, to 35 | * distinguish affected users. See `affected_users_count` in 36 | * `ErrorGroupStats`. 37 | * 38 | * Generated from protobuf field string user = 2; 39 | */ 40 | private $user = ''; 41 | /** 42 | * The location in the source code where the decision was made to 43 | * report the error, usually the place where it was logged. 44 | * For a logged exception this would be the source line where the 45 | * exception is logged, usually close to the place where it was 46 | * caught. 47 | * 48 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3; 49 | */ 50 | private $report_location = null; 51 | 52 | /** 53 | * Constructor. 54 | * 55 | * @param array $data { 56 | * Optional. Data for populating the Message object. 57 | * 58 | * @type \Google\Cloud\ErrorReporting\V1beta1\HttpRequestContext $http_request 59 | * The HTTP request which was processed when the error was 60 | * triggered. 61 | * @type string $user 62 | * The user who caused or was affected by the crash. 63 | * This can be a user ID, an email address, or an arbitrary token that 64 | * uniquely identifies the user. 65 | * When sending an error report, leave this field empty if the user was not 66 | * logged in. In this case the 67 | * Error Reporting system will use other data, such as remote IP address, to 68 | * distinguish affected users. See `affected_users_count` in 69 | * `ErrorGroupStats`. 70 | * @type \Google\Cloud\ErrorReporting\V1beta1\SourceLocation $report_location 71 | * The location in the source code where the decision was made to 72 | * report the error, usually the place where it was logged. 73 | * For a logged exception this would be the source line where the 74 | * exception is logged, usually close to the place where it was 75 | * caught. 76 | * } 77 | */ 78 | public function __construct($data = NULL) { 79 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); 80 | parent::__construct($data); 81 | } 82 | 83 | /** 84 | * The HTTP request which was processed when the error was 85 | * triggered. 86 | * 87 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1; 88 | * @return \Google\Cloud\ErrorReporting\V1beta1\HttpRequestContext|null 89 | */ 90 | public function getHttpRequest() 91 | { 92 | return $this->http_request; 93 | } 94 | 95 | public function hasHttpRequest() 96 | { 97 | return isset($this->http_request); 98 | } 99 | 100 | public function clearHttpRequest() 101 | { 102 | unset($this->http_request); 103 | } 104 | 105 | /** 106 | * The HTTP request which was processed when the error was 107 | * triggered. 108 | * 109 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1; 110 | * @param \Google\Cloud\ErrorReporting\V1beta1\HttpRequestContext $var 111 | * @return $this 112 | */ 113 | public function setHttpRequest($var) 114 | { 115 | GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\HttpRequestContext::class); 116 | $this->http_request = $var; 117 | 118 | return $this; 119 | } 120 | 121 | /** 122 | * The user who caused or was affected by the crash. 123 | * This can be a user ID, an email address, or an arbitrary token that 124 | * uniquely identifies the user. 125 | * When sending an error report, leave this field empty if the user was not 126 | * logged in. In this case the 127 | * Error Reporting system will use other data, such as remote IP address, to 128 | * distinguish affected users. See `affected_users_count` in 129 | * `ErrorGroupStats`. 130 | * 131 | * Generated from protobuf field string user = 2; 132 | * @return string 133 | */ 134 | public function getUser() 135 | { 136 | return $this->user; 137 | } 138 | 139 | /** 140 | * The user who caused or was affected by the crash. 141 | * This can be a user ID, an email address, or an arbitrary token that 142 | * uniquely identifies the user. 143 | * When sending an error report, leave this field empty if the user was not 144 | * logged in. In this case the 145 | * Error Reporting system will use other data, such as remote IP address, to 146 | * distinguish affected users. See `affected_users_count` in 147 | * `ErrorGroupStats`. 148 | * 149 | * Generated from protobuf field string user = 2; 150 | * @param string $var 151 | * @return $this 152 | */ 153 | public function setUser($var) 154 | { 155 | GPBUtil::checkString($var, True); 156 | $this->user = $var; 157 | 158 | return $this; 159 | } 160 | 161 | /** 162 | * The location in the source code where the decision was made to 163 | * report the error, usually the place where it was logged. 164 | * For a logged exception this would be the source line where the 165 | * exception is logged, usually close to the place where it was 166 | * caught. 167 | * 168 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3; 169 | * @return \Google\Cloud\ErrorReporting\V1beta1\SourceLocation|null 170 | */ 171 | public function getReportLocation() 172 | { 173 | return $this->report_location; 174 | } 175 | 176 | public function hasReportLocation() 177 | { 178 | return isset($this->report_location); 179 | } 180 | 181 | public function clearReportLocation() 182 | { 183 | unset($this->report_location); 184 | } 185 | 186 | /** 187 | * The location in the source code where the decision was made to 188 | * report the error, usually the place where it was logged. 189 | * For a logged exception this would be the source line where the 190 | * exception is logged, usually close to the place where it was 191 | * caught. 192 | * 193 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3; 194 | * @param \Google\Cloud\ErrorReporting\V1beta1\SourceLocation $var 195 | * @return $this 196 | */ 197 | public function setReportLocation($var) 198 | { 199 | GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\SourceLocation::class); 200 | $this->report_location = $var; 201 | 202 | return $this; 203 | } 204 | 205 | } 206 | 207 | -------------------------------------------------------------------------------- /src/V1beta1/GetGroupRequest.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.GetGroupRequest 15 | */ 16 | class GetGroupRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The group resource name. Written as either 20 | * `projects/{projectID}/groups/{group_id}` or 21 | * `projects/{projectID}/locations/{location}/groups/{group_id}`. Call 22 | * [groupStats.list] 23 | * [google.devtools.clouderrorreporting.v1beta1.ErrorStatsService.ListGroupStats] 24 | * to return a list of groups belonging to this project. 25 | * Examples: `projects/my-project-123/groups/my-group`, 26 | * `projects/my-project-123/locations/global/groups/my-group` 27 | * In the group resource name, the `group_id` is a unique identifier for a 28 | * particular error group. The identifier is derived from key parts of the 29 | * error-log content and is treated as Service Data. For information about 30 | * how Service Data is handled, see [Google Cloud Privacy 31 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 32 | * For a list of supported locations, see [Supported 33 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 34 | * the default when unspecified. 35 | * 36 | * Generated from protobuf field string group_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 37 | */ 38 | private $group_name = ''; 39 | 40 | /** 41 | * @param string $groupName Required. The group resource name. Written as either 42 | * `projects/{projectID}/groups/{group_id}` or 43 | * `projects/{projectID}/locations/{location}/groups/{group_id}`. Call 44 | * [groupStats.list] 45 | * [google.devtools.clouderrorreporting.v1beta1.ErrorStatsService.ListGroupStats] 46 | * to return a list of groups belonging to this project. 47 | * 48 | * Examples: `projects/my-project-123/groups/my-group`, 49 | * `projects/my-project-123/locations/global/groups/my-group` 50 | * 51 | * In the group resource name, the `group_id` is a unique identifier for a 52 | * particular error group. The identifier is derived from key parts of the 53 | * error-log content and is treated as Service Data. For information about 54 | * how Service Data is handled, see [Google Cloud Privacy 55 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 56 | * 57 | * For a list of supported locations, see [Supported 58 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 59 | * the default when unspecified. Please see 60 | * {@see ErrorGroupServiceClient::errorGroupName()} for help formatting this field. 61 | * 62 | * @return \Google\Cloud\ErrorReporting\V1beta1\GetGroupRequest 63 | * 64 | * @experimental 65 | */ 66 | public static function build(string $groupName): self 67 | { 68 | return (new self()) 69 | ->setGroupName($groupName); 70 | } 71 | 72 | /** 73 | * Constructor. 74 | * 75 | * @param array $data { 76 | * Optional. Data for populating the Message object. 77 | * 78 | * @type string $group_name 79 | * Required. The group resource name. Written as either 80 | * `projects/{projectID}/groups/{group_id}` or 81 | * `projects/{projectID}/locations/{location}/groups/{group_id}`. Call 82 | * [groupStats.list] 83 | * [google.devtools.clouderrorreporting.v1beta1.ErrorStatsService.ListGroupStats] 84 | * to return a list of groups belonging to this project. 85 | * Examples: `projects/my-project-123/groups/my-group`, 86 | * `projects/my-project-123/locations/global/groups/my-group` 87 | * In the group resource name, the `group_id` is a unique identifier for a 88 | * particular error group. The identifier is derived from key parts of the 89 | * error-log content and is treated as Service Data. For information about 90 | * how Service Data is handled, see [Google Cloud Privacy 91 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 92 | * For a list of supported locations, see [Supported 93 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 94 | * the default when unspecified. 95 | * } 96 | */ 97 | public function __construct($data = NULL) { 98 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ErrorGroupService::initOnce(); 99 | parent::__construct($data); 100 | } 101 | 102 | /** 103 | * Required. The group resource name. Written as either 104 | * `projects/{projectID}/groups/{group_id}` or 105 | * `projects/{projectID}/locations/{location}/groups/{group_id}`. Call 106 | * [groupStats.list] 107 | * [google.devtools.clouderrorreporting.v1beta1.ErrorStatsService.ListGroupStats] 108 | * to return a list of groups belonging to this project. 109 | * Examples: `projects/my-project-123/groups/my-group`, 110 | * `projects/my-project-123/locations/global/groups/my-group` 111 | * In the group resource name, the `group_id` is a unique identifier for a 112 | * particular error group. The identifier is derived from key parts of the 113 | * error-log content and is treated as Service Data. For information about 114 | * how Service Data is handled, see [Google Cloud Privacy 115 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 116 | * For a list of supported locations, see [Supported 117 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 118 | * the default when unspecified. 119 | * 120 | * Generated from protobuf field string group_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 121 | * @return string 122 | */ 123 | public function getGroupName() 124 | { 125 | return $this->group_name; 126 | } 127 | 128 | /** 129 | * Required. The group resource name. Written as either 130 | * `projects/{projectID}/groups/{group_id}` or 131 | * `projects/{projectID}/locations/{location}/groups/{group_id}`. Call 132 | * [groupStats.list] 133 | * [google.devtools.clouderrorreporting.v1beta1.ErrorStatsService.ListGroupStats] 134 | * to return a list of groups belonging to this project. 135 | * Examples: `projects/my-project-123/groups/my-group`, 136 | * `projects/my-project-123/locations/global/groups/my-group` 137 | * In the group resource name, the `group_id` is a unique identifier for a 138 | * particular error group. The identifier is derived from key parts of the 139 | * error-log content and is treated as Service Data. For information about 140 | * how Service Data is handled, see [Google Cloud Privacy 141 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 142 | * For a list of supported locations, see [Supported 143 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 144 | * the default when unspecified. 145 | * 146 | * Generated from protobuf field string group_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 147 | * @param string $var 148 | * @return $this 149 | */ 150 | public function setGroupName($var) 151 | { 152 | GPBUtil::checkString($var, True); 153 | $this->group_name = $var; 154 | 155 | return $this; 156 | } 157 | 158 | } 159 | 160 | -------------------------------------------------------------------------------- /src/V1beta1/ErrorGroup.php: -------------------------------------------------------------------------------- 1 | google.devtools.clouderrorreporting.v1beta1.ErrorGroup 15 | */ 16 | class ErrorGroup extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * The group resource name. 20 | * Written as `projects/{projectID}/groups/{group_id}` or 21 | * `projects/{projectID}/locations/{location}/groups/{group_id}` 22 | * Examples: `projects/my-project-123/groups/my-group`, 23 | * `projects/my-project-123/locations/us-central1/groups/my-group` 24 | * In the group resource name, the `group_id` is a unique identifier for a 25 | * particular error group. The identifier is derived from key parts of the 26 | * error-log content and is treated as Service Data. For information about 27 | * how Service Data is handled, see [Google Cloud Privacy 28 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 29 | * For a list of supported locations, see [Supported 30 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 31 | * the default when unspecified. 32 | * 33 | * Generated from protobuf field string name = 1; 34 | */ 35 | private $name = ''; 36 | /** 37 | * An opaque identifier of the group. This field is assigned by the Error 38 | * Reporting system and always populated. 39 | * In the group resource name, the `group_id` is a unique identifier for a 40 | * particular error group. The identifier is derived from key parts of the 41 | * error-log content and is treated as Service Data. For information about 42 | * how Service Data is handled, see [Google Cloud Privacy 43 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 44 | * 45 | * Generated from protobuf field string group_id = 2; 46 | */ 47 | private $group_id = ''; 48 | /** 49 | * Associated tracking issues. 50 | * 51 | * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.TrackingIssue tracking_issues = 3; 52 | */ 53 | private $tracking_issues; 54 | /** 55 | * Error group's resolution status. 56 | * An unspecified resolution status will be interpreted as OPEN 57 | * 58 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ResolutionStatus resolution_status = 5; 59 | */ 60 | private $resolution_status = 0; 61 | 62 | /** 63 | * Constructor. 64 | * 65 | * @param array $data { 66 | * Optional. Data for populating the Message object. 67 | * 68 | * @type string $name 69 | * The group resource name. 70 | * Written as `projects/{projectID}/groups/{group_id}` or 71 | * `projects/{projectID}/locations/{location}/groups/{group_id}` 72 | * Examples: `projects/my-project-123/groups/my-group`, 73 | * `projects/my-project-123/locations/us-central1/groups/my-group` 74 | * In the group resource name, the `group_id` is a unique identifier for a 75 | * particular error group. The identifier is derived from key parts of the 76 | * error-log content and is treated as Service Data. For information about 77 | * how Service Data is handled, see [Google Cloud Privacy 78 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 79 | * For a list of supported locations, see [Supported 80 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 81 | * the default when unspecified. 82 | * @type string $group_id 83 | * An opaque identifier of the group. This field is assigned by the Error 84 | * Reporting system and always populated. 85 | * In the group resource name, the `group_id` is a unique identifier for a 86 | * particular error group. The identifier is derived from key parts of the 87 | * error-log content and is treated as Service Data. For information about 88 | * how Service Data is handled, see [Google Cloud Privacy 89 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 90 | * @type array<\Google\Cloud\ErrorReporting\V1beta1\TrackingIssue>|\Google\Protobuf\Internal\RepeatedField $tracking_issues 91 | * Associated tracking issues. 92 | * @type int $resolution_status 93 | * Error group's resolution status. 94 | * An unspecified resolution status will be interpreted as OPEN 95 | * } 96 | */ 97 | public function __construct($data = NULL) { 98 | \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\Common::initOnce(); 99 | parent::__construct($data); 100 | } 101 | 102 | /** 103 | * The group resource name. 104 | * Written as `projects/{projectID}/groups/{group_id}` or 105 | * `projects/{projectID}/locations/{location}/groups/{group_id}` 106 | * Examples: `projects/my-project-123/groups/my-group`, 107 | * `projects/my-project-123/locations/us-central1/groups/my-group` 108 | * In the group resource name, the `group_id` is a unique identifier for a 109 | * particular error group. The identifier is derived from key parts of the 110 | * error-log content and is treated as Service Data. For information about 111 | * how Service Data is handled, see [Google Cloud Privacy 112 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 113 | * For a list of supported locations, see [Supported 114 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 115 | * the default when unspecified. 116 | * 117 | * Generated from protobuf field string name = 1; 118 | * @return string 119 | */ 120 | public function getName() 121 | { 122 | return $this->name; 123 | } 124 | 125 | /** 126 | * The group resource name. 127 | * Written as `projects/{projectID}/groups/{group_id}` or 128 | * `projects/{projectID}/locations/{location}/groups/{group_id}` 129 | * Examples: `projects/my-project-123/groups/my-group`, 130 | * `projects/my-project-123/locations/us-central1/groups/my-group` 131 | * In the group resource name, the `group_id` is a unique identifier for a 132 | * particular error group. The identifier is derived from key parts of the 133 | * error-log content and is treated as Service Data. For information about 134 | * how Service Data is handled, see [Google Cloud Privacy 135 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 136 | * For a list of supported locations, see [Supported 137 | * Regions](https://cloud.google.com/logging/docs/region-support). `global` is 138 | * the default when unspecified. 139 | * 140 | * Generated from protobuf field string name = 1; 141 | * @param string $var 142 | * @return $this 143 | */ 144 | public function setName($var) 145 | { 146 | GPBUtil::checkString($var, True); 147 | $this->name = $var; 148 | 149 | return $this; 150 | } 151 | 152 | /** 153 | * An opaque identifier of the group. This field is assigned by the Error 154 | * Reporting system and always populated. 155 | * In the group resource name, the `group_id` is a unique identifier for a 156 | * particular error group. The identifier is derived from key parts of the 157 | * error-log content and is treated as Service Data. For information about 158 | * how Service Data is handled, see [Google Cloud Privacy 159 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 160 | * 161 | * Generated from protobuf field string group_id = 2; 162 | * @return string 163 | */ 164 | public function getGroupId() 165 | { 166 | return $this->group_id; 167 | } 168 | 169 | /** 170 | * An opaque identifier of the group. This field is assigned by the Error 171 | * Reporting system and always populated. 172 | * In the group resource name, the `group_id` is a unique identifier for a 173 | * particular error group. The identifier is derived from key parts of the 174 | * error-log content and is treated as Service Data. For information about 175 | * how Service Data is handled, see [Google Cloud Privacy 176 | * Notice](https://cloud.google.com/terms/cloud-privacy-notice). 177 | * 178 | * Generated from protobuf field string group_id = 2; 179 | * @param string $var 180 | * @return $this 181 | */ 182 | public function setGroupId($var) 183 | { 184 | GPBUtil::checkString($var, True); 185 | $this->group_id = $var; 186 | 187 | return $this; 188 | } 189 | 190 | /** 191 | * Associated tracking issues. 192 | * 193 | * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.TrackingIssue tracking_issues = 3; 194 | * @return \Google\Protobuf\Internal\RepeatedField 195 | */ 196 | public function getTrackingIssues() 197 | { 198 | return $this->tracking_issues; 199 | } 200 | 201 | /** 202 | * Associated tracking issues. 203 | * 204 | * Generated from protobuf field repeated .google.devtools.clouderrorreporting.v1beta1.TrackingIssue tracking_issues = 3; 205 | * @param array<\Google\Cloud\ErrorReporting\V1beta1\TrackingIssue>|\Google\Protobuf\Internal\RepeatedField $var 206 | * @return $this 207 | */ 208 | public function setTrackingIssues($var) 209 | { 210 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\TrackingIssue::class); 211 | $this->tracking_issues = $arr; 212 | 213 | return $this; 214 | } 215 | 216 | /** 217 | * Error group's resolution status. 218 | * An unspecified resolution status will be interpreted as OPEN 219 | * 220 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ResolutionStatus resolution_status = 5; 221 | * @return int 222 | */ 223 | public function getResolutionStatus() 224 | { 225 | return $this->resolution_status; 226 | } 227 | 228 | /** 229 | * Error group's resolution status. 230 | * An unspecified resolution status will be interpreted as OPEN 231 | * 232 | * Generated from protobuf field .google.devtools.clouderrorreporting.v1beta1.ResolutionStatus resolution_status = 5; 233 | * @param int $var 234 | * @return $this 235 | */ 236 | public function setResolutionStatus($var) 237 | { 238 | GPBUtil::checkEnum($var, \Google\Cloud\ErrorReporting\V1beta1\ResolutionStatus::class); 239 | $this->resolution_status = $var; 240 | 241 | return $this; 242 | } 243 | 244 | } 245 | 246 | -------------------------------------------------------------------------------- /src/Bootstrap.php: -------------------------------------------------------------------------------- 1 | psrLogger(self::DEFAULT_LOGNAME, [ 40 | 'batchEnabled' => true, 41 | 'debugOutput' => true, 42 | 'batchOptions' => [ 43 | 'numWorkers' => 2 44 | ] 45 | ]); 46 | register_shutdown_function([self::class, 'shutdownHandler']); 47 | set_exception_handler([self::class, 'exceptionHandler']); 48 | set_error_handler([self::class, 'errorHandler']); 49 | } 50 | 51 | /** 52 | * Return a string prefix for the given error level. 53 | * 54 | * @param int $level 55 | * @return string A string prefix for reporting the error. 56 | */ 57 | public static function getErrorPrefix($level) 58 | { 59 | switch ($level) { 60 | case E_PARSE: 61 | $prefix = 'PHP Parse error'; 62 | break; 63 | case E_ERROR: 64 | case E_CORE_ERROR: 65 | case E_COMPILE_ERROR: 66 | $prefix = 'PHP Fatal error'; 67 | break; 68 | case E_USER_ERROR: 69 | case E_RECOVERABLE_ERROR: 70 | $prefix = 'PHP error'; 71 | break; 72 | case E_WARNING: 73 | case E_CORE_WARNING: 74 | case E_COMPILE_WARNING: 75 | case E_USER_WARNING: 76 | $prefix = 'PHP Warning'; 77 | break; 78 | case E_NOTICE: 79 | case E_USER_NOTICE: 80 | $prefix = 'PHP Notice'; 81 | break; 82 | default: 83 | $prefix = 'PHP Notice'; 84 | } 85 | return $prefix; 86 | } 87 | 88 | /** 89 | * Return an error level string for the given PHP error level. 90 | * 91 | * @param int $level 92 | * @return string An error level string. 93 | */ 94 | public static function getErrorLevelString($level) 95 | { 96 | switch ($level) { 97 | case E_PARSE: 98 | return 'CRITICAL'; 99 | case E_ERROR: 100 | case E_CORE_ERROR: 101 | case E_COMPILE_ERROR: 102 | case E_USER_ERROR: 103 | case E_RECOVERABLE_ERROR: 104 | return 'ERROR'; 105 | case E_WARNING: 106 | case E_CORE_WARNING: 107 | case E_COMPILE_WARNING: 108 | case E_USER_WARNING: 109 | return 'WARNING'; 110 | case E_NOTICE: 111 | case E_USER_NOTICE: 112 | return 'NOTICE'; 113 | default: 114 | return 'NOTICE'; 115 | } 116 | } 117 | 118 | /** 119 | * @param mixed $ex \Throwable (PHP 7) or \Exception (PHP 5) 120 | */ 121 | public static function exceptionHandler($ex) 122 | { 123 | $message = sprintf('PHP Notice: %s', (string) $ex); 124 | if (self::$psrLogger) { 125 | $service = self::$psrLogger->getMetadataProvider()->serviceId(); 126 | $version = self::$psrLogger->getMetadataProvider()->versionId(); 127 | $context = [ 128 | 'context' => [ 129 | 'reportLocation' => [ 130 | 'filePath' => $ex->getFile(), 131 | 'lineNumber' => $ex->getLine(), 132 | 'functionName' => 133 | self::getFunctionNameForReport($ex->getTrace()), 134 | ] 135 | ], 136 | 'serviceContext' => [ 137 | 'service' => $service, 138 | 'version' => $version, 139 | ] 140 | ]; 141 | $httpRequest = self::getHttpRequest(); 142 | if (!empty($httpRequest)) { 143 | $context['context']['httpRequest'] = self::getHttpRequest(); 144 | } 145 | self::$psrLogger->error($message, $context); 146 | } else { 147 | $stderr = defined('STDERR') ? STDERR : fopen('php://stderr', 'w'); 148 | fwrite($stderr, $message . PHP_EOL); 149 | } 150 | } 151 | 152 | /** 153 | * @param int $level The error level. 154 | * @param string $message The error message. 155 | * @param string $file The filename that the error was raised in. 156 | * @param int $line The line number that the error was raised at. 157 | */ 158 | public static function errorHandler($level, $message, $file, $line) 159 | { 160 | if (!($level & error_reporting())) { 161 | return true; 162 | } 163 | $message = sprintf( 164 | '%s: %s in %s on line %d', 165 | self::getErrorPrefix($level), 166 | $message, 167 | $file, 168 | $line 169 | ); 170 | if (!self::$psrLogger) { 171 | return false; 172 | } 173 | $service = self::$psrLogger->getMetadataProvider()->serviceId(); 174 | $version = self::$psrLogger->getMetadataProvider()->versionId(); 175 | $context = [ 176 | 'context' => [ 177 | 'reportLocation' => [ 178 | 'filePath' => $file, 179 | 'lineNumber' => $line, 180 | 'functionName' => 181 | self::getFunctionNameForReport(), 182 | ] 183 | ], 184 | 'serviceContext' => [ 185 | 'service' => $service, 186 | 'version' => $version 187 | ] 188 | ]; 189 | $httpRequest = self::getHttpRequest(); 190 | if (!empty($httpRequest)) { 191 | $context['context']['httpRequest'] = self::getHttpRequest(); 192 | } 193 | self::$psrLogger->log( 194 | self::getErrorLevelString($level), 195 | $message, 196 | $context 197 | ); 198 | } 199 | 200 | /** 201 | * Called at exit, to check there's a fatal error and report the error if 202 | * any. 203 | */ 204 | public static function shutdownHandler() 205 | { 206 | if ($err = error_get_last()) { 207 | switch ($err['type']) { 208 | case E_ERROR: 209 | case E_PARSE: 210 | case E_COMPILE_ERROR: 211 | case E_CORE_ERROR: 212 | $service = self::$psrLogger 213 | ->getMetadataProvider() 214 | ->serviceId(); 215 | $version = self::$psrLogger 216 | ->getMetadataProvider() 217 | ->versionId(); 218 | $message = sprintf( 219 | '%s: %s in %s on line %d', 220 | self::getErrorPrefix($err['type']), 221 | $err['message'], 222 | $err['file'], 223 | $err['line'] 224 | ); 225 | $context = [ 226 | 'context' => [ 227 | 'reportLocation' => [ 228 | 'filePath' => $err['file'], 229 | 'lineNumber' => $err['line'], 230 | 'functionName' => 231 | self::getFunctionNameForReport(), 232 | ] 233 | ], 234 | 'serviceContext' => [ 235 | 'service' => $service, 236 | 'version' => $version 237 | ] 238 | ]; 239 | $httpRequest = self::getHttpRequest(); 240 | if (!empty($httpRequest)) { 241 | $context['context']['httpRequest'] = self::getHttpRequest(); 242 | } 243 | if (self::$psrLogger) { 244 | self::$psrLogger->log( 245 | self::getErrorLevelString($err['type']), 246 | $message, 247 | $context 248 | ); 249 | } 250 | break; 251 | } 252 | } 253 | } 254 | 255 | /** 256 | * Format the function name from a stack trace. This could be a global 257 | * function (function_name), a class function (Class->function), or a static 258 | * function (Class::function). 259 | * 260 | * @param array $trace The stack trace returned from Exception::getTrace() 261 | */ 262 | private static function getFunctionNameForReport(?array $trace = null) 263 | { 264 | if (null === $trace) { 265 | return ''; 266 | } 267 | if (empty($trace[0]['function'])) { 268 | return ''; 269 | } 270 | $functionName = [$trace[0]['function']]; 271 | if (isset($trace[0]['type'])) { 272 | $functionName[] = $trace[0]['type']; 273 | } 274 | if (isset($trace[0]['class'])) { 275 | $functionName[] = $trace[0]['class']; 276 | } 277 | return implode('', array_reverse($functionName)); 278 | } 279 | 280 | /** 281 | * Builds an HttpRequestContext from available server information. 282 | * 283 | * @return array An HttpRequestContext. 284 | */ 285 | private static function getHttpRequest() 286 | { 287 | $httpRequest = []; 288 | if (isset($_SERVER)) { 289 | if (isset($_SERVER['REQUEST_METHOD'])) { 290 | $httpRequest['method'] = $_SERVER['REQUEST_METHOD']; 291 | } 292 | if (isset($_SERVER['HTTP_USER_AGENT'])) { 293 | $httpRequest['userAgent'] = $_SERVER['HTTP_USER_AGENT']; 294 | } 295 | if (isset($_SERVER['HTTP_REFERER'])) { 296 | $httpRequest['referrer'] = $_SERVER['HTTP_REFERER']; 297 | } 298 | if (isset($_SERVER['REMOTE_ADDR'])) { 299 | $httpRequest['remoteIp'] = $_SERVER['REMOTE_ADDR']; 300 | } 301 | if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { 302 | $httpRequest['url'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') 303 | . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 304 | } 305 | if (http_response_code() !== false) { 306 | $httpRequest['responseStatusCode'] = http_response_code(); 307 | } 308 | } 309 | return $httpRequest; 310 | } 311 | } 312 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /src/V1beta1/Client/ReportErrorsServiceClient.php: -------------------------------------------------------------------------------- 1 | reportErrorEventAsync(ReportErrorEventRequest $request, array $optionalArgs = []) 57 | */ 58 | final class ReportErrorsServiceClient 59 | { 60 | use GapicClientTrait; 61 | use ResourceHelperTrait; 62 | 63 | /** The name of the service. */ 64 | private const SERVICE_NAME = 'google.devtools.clouderrorreporting.v1beta1.ReportErrorsService'; 65 | 66 | /** 67 | * The default address of the service. 68 | * 69 | * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. 70 | */ 71 | private const SERVICE_ADDRESS = 'clouderrorreporting.googleapis.com'; 72 | 73 | /** The address template of the service. */ 74 | private const SERVICE_ADDRESS_TEMPLATE = 'clouderrorreporting.UNIVERSE_DOMAIN'; 75 | 76 | /** The default port of the service. */ 77 | private const DEFAULT_SERVICE_PORT = 443; 78 | 79 | /** The name of the code generator, to be included in the agent header. */ 80 | private const CODEGEN_NAME = 'gapic'; 81 | 82 | /** The default scopes required by the service. */ 83 | public static $serviceScopes = [ 84 | 'https://www.googleapis.com/auth/cloud-platform', 85 | ]; 86 | 87 | private static function getClientDefaults() 88 | { 89 | return [ 90 | 'serviceName' => self::SERVICE_NAME, 91 | 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, 92 | 'clientConfig' => __DIR__ . '/../resources/report_errors_service_client_config.json', 93 | 'descriptorsConfigPath' => __DIR__ . '/../resources/report_errors_service_descriptor_config.php', 94 | 'gcpApiConfigPath' => __DIR__ . '/../resources/report_errors_service_grpc_config.json', 95 | 'credentialsConfig' => [ 96 | 'defaultScopes' => self::$serviceScopes, 97 | ], 98 | 'transportConfig' => [ 99 | 'rest' => [ 100 | 'restClientConfigPath' => __DIR__ . '/../resources/report_errors_service_rest_client_config.php', 101 | ], 102 | ], 103 | ]; 104 | } 105 | 106 | /** 107 | * Formats a string containing the fully-qualified path to represent a project 108 | * resource. 109 | * 110 | * @param string $project 111 | * 112 | * @return string The formatted project resource. 113 | * 114 | * @experimental 115 | */ 116 | public static function projectName(string $project): string 117 | { 118 | return self::getPathTemplate('project')->render([ 119 | 'project' => $project, 120 | ]); 121 | } 122 | 123 | /** 124 | * Parses a formatted name string and returns an associative array of the components in the name. 125 | * The following name formats are supported: 126 | * Template: Pattern 127 | * - project: projects/{project} 128 | * 129 | * The optional $template argument can be supplied to specify a particular pattern, 130 | * and must match one of the templates listed above. If no $template argument is 131 | * provided, or if the $template argument does not match one of the templates 132 | * listed, then parseName will check each of the supported templates, and return 133 | * the first match. 134 | * 135 | * @param string $formattedName The formatted name string 136 | * @param ?string $template Optional name of template to match 137 | * 138 | * @return array An associative array from name component IDs to component values. 139 | * 140 | * @throws ValidationException If $formattedName could not be matched. 141 | * 142 | * @experimental 143 | */ 144 | public static function parseName(string $formattedName, ?string $template = null): array 145 | { 146 | return self::parseFormattedName($formattedName, $template); 147 | } 148 | 149 | /** 150 | * Constructor. 151 | * 152 | * @param array|ClientOptions $options { 153 | * Optional. Options for configuring the service API wrapper. 154 | * 155 | * @type string $apiEndpoint 156 | * The address of the API remote host. May optionally include the port, formatted 157 | * as ":". Default 'clouderrorreporting.googleapis.com:443'. 158 | * @type FetchAuthTokenInterface|CredentialsWrapper $credentials 159 | * This option should only be used with a pre-constructed 160 | * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that 161 | * when one of these objects are provided, any settings in $credentialsConfig will 162 | * be ignored. 163 | * **Important**: If you are providing a path to a credentials file, or a decoded 164 | * credentials file as a PHP array, this usage is now DEPRECATED. Providing an 165 | * unvalidated credential configuration to Google APIs can compromise the security 166 | * of your systems and data. It is recommended to create the credentials explicitly 167 | * ``` 168 | * use Google\Auth\Credentials\ServiceAccountCredentials; 169 | * use Google\Cloud\ErrorReporting\V1beta1\ReportErrorsServiceClient; 170 | * $creds = new ServiceAccountCredentials($scopes, $json); 171 | * $options = new ReportErrorsServiceClient(['credentials' => $creds]); 172 | * ``` 173 | * {@see 174 | * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} 175 | * @type array $credentialsConfig 176 | * Options used to configure credentials, including auth token caching, for the 177 | * client. For a full list of supporting configuration options, see 178 | * {@see \Google\ApiCore\CredentialsWrapper::build()} . 179 | * @type bool $disableRetries 180 | * Determines whether or not retries defined by the client configuration should be 181 | * disabled. Defaults to `false`. 182 | * @type string|array $clientConfig 183 | * Client method configuration, including retry settings. This option can be either 184 | * a path to a JSON file, or a PHP array containing the decoded JSON data. By 185 | * default this settings points to the default client config file, which is 186 | * provided in the resources folder. 187 | * @type string|TransportInterface $transport 188 | * The transport used for executing network requests. May be either the string 189 | * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. 190 | * *Advanced usage*: Additionally, it is possible to pass in an already 191 | * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note 192 | * that when this object is provided, any settings in $transportConfig, and any 193 | * $apiEndpoint setting, will be ignored. 194 | * @type array $transportConfig 195 | * Configuration options that will be used to construct the transport. Options for 196 | * each supported transport type should be passed in a key for that transport. For 197 | * example: 198 | * $transportConfig = [ 199 | * 'grpc' => [...], 200 | * 'rest' => [...], 201 | * ]; 202 | * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and 203 | * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the 204 | * supported options. 205 | * @type callable $clientCertSource 206 | * A callable which returns the client cert as a string. This can be used to 207 | * provide a certificate and private key to the transport layer for mTLS. 208 | * @type false|LoggerInterface $logger 209 | * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 210 | * 'GOOGLE_SDK_PHP_LOGGING' environment flag 211 | * @type string $universeDomain 212 | * The service domain for the client. Defaults to 'googleapis.com'. 213 | * } 214 | * 215 | * @throws ValidationException 216 | * 217 | * @experimental 218 | */ 219 | public function __construct(array|ClientOptions $options = []) 220 | { 221 | $clientOptions = $this->buildClientOptions($options); 222 | $this->setClientOptions($clientOptions); 223 | } 224 | 225 | /** Handles execution of the async variants for each documented method. */ 226 | public function __call($method, $args) 227 | { 228 | if (substr($method, -5) !== 'Async') { 229 | trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); 230 | } 231 | 232 | array_unshift($args, substr($method, 0, -5)); 233 | return call_user_func_array([$this, 'startAsyncCall'], $args); 234 | } 235 | 236 | /** 237 | * Report an individual error event and record the event to a log. 238 | * 239 | * This endpoint accepts **either** an OAuth token, 240 | * **or** an [API key](https://support.google.com/cloud/answer/6158862) 241 | * for authentication. To use an API key, append it to the URL as the value of 242 | * a `key` parameter. For example: 243 | * 244 | * `POST 245 | * https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events:report?key=123ABC456` 246 | * 247 | * **Note:** [Error Reporting] (https://cloud.google.com/error-reporting) 248 | * is a service built on Cloud Logging and can analyze log entries when all of 249 | * the following are true: 250 | * 251 | * * Customer-managed encryption keys (CMEK) are disabled on the log bucket. 252 | * * The log bucket satisfies one of the following: 253 | * * The log bucket is stored in the same project where the logs 254 | * originated. 255 | * * The logs were routed to a project, and then that project stored those 256 | * logs in a log bucket that it owns. 257 | * 258 | * The async variant is {@see ReportErrorsServiceClient::reportErrorEventAsync()} . 259 | * 260 | * @example samples/V1beta1/ReportErrorsServiceClient/report_error_event.php 261 | * 262 | * @param ReportErrorEventRequest $request A request to house fields associated with the call. 263 | * @param array $callOptions { 264 | * Optional. 265 | * 266 | * @type RetrySettings|array $retrySettings 267 | * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an 268 | * associative array of retry settings parameters. See the documentation on 269 | * {@see RetrySettings} for example usage. 270 | * } 271 | * 272 | * @return ReportErrorEventResponse 273 | * 274 | * @throws ApiException Thrown if the API call fails. 275 | * 276 | * @experimental 277 | */ 278 | public function reportErrorEvent(ReportErrorEventRequest $request, array $callOptions = []): ReportErrorEventResponse 279 | { 280 | return $this->startApiCall('ReportErrorEvent', $request, $callOptions)->wait(); 281 | } 282 | } 283 | -------------------------------------------------------------------------------- /src/V1beta1/Client/ErrorGroupServiceClient.php: -------------------------------------------------------------------------------- 1 | getGroupAsync(GetGroupRequest $request, array $optionalArgs = []) 58 | * @method PromiseInterface updateGroupAsync(UpdateGroupRequest $request, array $optionalArgs = []) 59 | */ 60 | final class ErrorGroupServiceClient 61 | { 62 | use GapicClientTrait; 63 | use ResourceHelperTrait; 64 | 65 | /** The name of the service. */ 66 | private const SERVICE_NAME = 'google.devtools.clouderrorreporting.v1beta1.ErrorGroupService'; 67 | 68 | /** 69 | * The default address of the service. 70 | * 71 | * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. 72 | */ 73 | private const SERVICE_ADDRESS = 'clouderrorreporting.googleapis.com'; 74 | 75 | /** The address template of the service. */ 76 | private const SERVICE_ADDRESS_TEMPLATE = 'clouderrorreporting.UNIVERSE_DOMAIN'; 77 | 78 | /** The default port of the service. */ 79 | private const DEFAULT_SERVICE_PORT = 443; 80 | 81 | /** The name of the code generator, to be included in the agent header. */ 82 | private const CODEGEN_NAME = 'gapic'; 83 | 84 | /** The default scopes required by the service. */ 85 | public static $serviceScopes = [ 86 | 'https://www.googleapis.com/auth/cloud-platform', 87 | ]; 88 | 89 | private static function getClientDefaults() 90 | { 91 | return [ 92 | 'serviceName' => self::SERVICE_NAME, 93 | 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, 94 | 'clientConfig' => __DIR__ . '/../resources/error_group_service_client_config.json', 95 | 'descriptorsConfigPath' => __DIR__ . '/../resources/error_group_service_descriptor_config.php', 96 | 'gcpApiConfigPath' => __DIR__ . '/../resources/error_group_service_grpc_config.json', 97 | 'credentialsConfig' => [ 98 | 'defaultScopes' => self::$serviceScopes, 99 | ], 100 | 'transportConfig' => [ 101 | 'rest' => [ 102 | 'restClientConfigPath' => __DIR__ . '/../resources/error_group_service_rest_client_config.php', 103 | ], 104 | ], 105 | ]; 106 | } 107 | 108 | /** 109 | * Formats a string containing the fully-qualified path to represent a error_group 110 | * resource. 111 | * 112 | * @param string $project 113 | * @param string $group 114 | * 115 | * @return string The formatted error_group resource. 116 | * 117 | * @experimental 118 | */ 119 | public static function errorGroupName(string $project, string $group): string 120 | { 121 | return self::getPathTemplate('errorGroup')->render([ 122 | 'project' => $project, 123 | 'group' => $group, 124 | ]); 125 | } 126 | 127 | /** 128 | * Parses a formatted name string and returns an associative array of the components in the name. 129 | * The following name formats are supported: 130 | * Template: Pattern 131 | * - errorGroup: projects/{project}/groups/{group} 132 | * 133 | * The optional $template argument can be supplied to specify a particular pattern, 134 | * and must match one of the templates listed above. If no $template argument is 135 | * provided, or if the $template argument does not match one of the templates 136 | * listed, then parseName will check each of the supported templates, and return 137 | * the first match. 138 | * 139 | * @param string $formattedName The formatted name string 140 | * @param ?string $template Optional name of template to match 141 | * 142 | * @return array An associative array from name component IDs to component values. 143 | * 144 | * @throws ValidationException If $formattedName could not be matched. 145 | * 146 | * @experimental 147 | */ 148 | public static function parseName(string $formattedName, ?string $template = null): array 149 | { 150 | return self::parseFormattedName($formattedName, $template); 151 | } 152 | 153 | /** 154 | * Constructor. 155 | * 156 | * @param array|ClientOptions $options { 157 | * Optional. Options for configuring the service API wrapper. 158 | * 159 | * @type string $apiEndpoint 160 | * The address of the API remote host. May optionally include the port, formatted 161 | * as ":". Default 'clouderrorreporting.googleapis.com:443'. 162 | * @type FetchAuthTokenInterface|CredentialsWrapper $credentials 163 | * This option should only be used with a pre-constructed 164 | * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that 165 | * when one of these objects are provided, any settings in $credentialsConfig will 166 | * be ignored. 167 | * **Important**: If you are providing a path to a credentials file, or a decoded 168 | * credentials file as a PHP array, this usage is now DEPRECATED. Providing an 169 | * unvalidated credential configuration to Google APIs can compromise the security 170 | * of your systems and data. It is recommended to create the credentials explicitly 171 | * ``` 172 | * use Google\Auth\Credentials\ServiceAccountCredentials; 173 | * use Google\Cloud\ErrorReporting\V1beta1\ErrorGroupServiceClient; 174 | * $creds = new ServiceAccountCredentials($scopes, $json); 175 | * $options = new ErrorGroupServiceClient(['credentials' => $creds]); 176 | * ``` 177 | * {@see 178 | * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} 179 | * @type array $credentialsConfig 180 | * Options used to configure credentials, including auth token caching, for the 181 | * client. For a full list of supporting configuration options, see 182 | * {@see \Google\ApiCore\CredentialsWrapper::build()} . 183 | * @type bool $disableRetries 184 | * Determines whether or not retries defined by the client configuration should be 185 | * disabled. Defaults to `false`. 186 | * @type string|array $clientConfig 187 | * Client method configuration, including retry settings. This option can be either 188 | * a path to a JSON file, or a PHP array containing the decoded JSON data. By 189 | * default this settings points to the default client config file, which is 190 | * provided in the resources folder. 191 | * @type string|TransportInterface $transport 192 | * The transport used for executing network requests. May be either the string 193 | * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. 194 | * *Advanced usage*: Additionally, it is possible to pass in an already 195 | * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note 196 | * that when this object is provided, any settings in $transportConfig, and any 197 | * $apiEndpoint setting, will be ignored. 198 | * @type array $transportConfig 199 | * Configuration options that will be used to construct the transport. Options for 200 | * each supported transport type should be passed in a key for that transport. For 201 | * example: 202 | * $transportConfig = [ 203 | * 'grpc' => [...], 204 | * 'rest' => [...], 205 | * ]; 206 | * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and 207 | * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the 208 | * supported options. 209 | * @type callable $clientCertSource 210 | * A callable which returns the client cert as a string. This can be used to 211 | * provide a certificate and private key to the transport layer for mTLS. 212 | * @type false|LoggerInterface $logger 213 | * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 214 | * 'GOOGLE_SDK_PHP_LOGGING' environment flag 215 | * @type string $universeDomain 216 | * The service domain for the client. Defaults to 'googleapis.com'. 217 | * } 218 | * 219 | * @throws ValidationException 220 | * 221 | * @experimental 222 | */ 223 | public function __construct(array|ClientOptions $options = []) 224 | { 225 | $clientOptions = $this->buildClientOptions($options); 226 | $this->setClientOptions($clientOptions); 227 | } 228 | 229 | /** Handles execution of the async variants for each documented method. */ 230 | public function __call($method, $args) 231 | { 232 | if (substr($method, -5) !== 'Async') { 233 | trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); 234 | } 235 | 236 | array_unshift($args, substr($method, 0, -5)); 237 | return call_user_func_array([$this, 'startAsyncCall'], $args); 238 | } 239 | 240 | /** 241 | * Get the specified group. 242 | * 243 | * The async variant is {@see ErrorGroupServiceClient::getGroupAsync()} . 244 | * 245 | * @example samples/V1beta1/ErrorGroupServiceClient/get_group.php 246 | * 247 | * @param GetGroupRequest $request A request to house fields associated with the call. 248 | * @param array $callOptions { 249 | * Optional. 250 | * 251 | * @type RetrySettings|array $retrySettings 252 | * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an 253 | * associative array of retry settings parameters. See the documentation on 254 | * {@see RetrySettings} for example usage. 255 | * } 256 | * 257 | * @return ErrorGroup 258 | * 259 | * @throws ApiException Thrown if the API call fails. 260 | * 261 | * @experimental 262 | */ 263 | public function getGroup(GetGroupRequest $request, array $callOptions = []): ErrorGroup 264 | { 265 | return $this->startApiCall('GetGroup', $request, $callOptions)->wait(); 266 | } 267 | 268 | /** 269 | * Replace the data for the specified group. 270 | * Fails if the group does not exist. 271 | * 272 | * The async variant is {@see ErrorGroupServiceClient::updateGroupAsync()} . 273 | * 274 | * @example samples/V1beta1/ErrorGroupServiceClient/update_group.php 275 | * 276 | * @param UpdateGroupRequest $request A request to house fields associated with the call. 277 | * @param array $callOptions { 278 | * Optional. 279 | * 280 | * @type RetrySettings|array $retrySettings 281 | * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an 282 | * associative array of retry settings parameters. See the documentation on 283 | * {@see RetrySettings} for example usage. 284 | * } 285 | * 286 | * @return ErrorGroup 287 | * 288 | * @throws ApiException Thrown if the API call fails. 289 | * 290 | * @experimental 291 | */ 292 | public function updateGroup(UpdateGroupRequest $request, array $callOptions = []): ErrorGroup 293 | { 294 | return $this->startApiCall('UpdateGroup', $request, $callOptions)->wait(); 295 | } 296 | } 297 | -------------------------------------------------------------------------------- /src/V1beta1/Gapic/ReportErrorsServiceGapicClient.php: -------------------------------------------------------------------------------- 1 | projectName('[PROJECT]'); 52 | * $event = new ReportedErrorEvent(); 53 | * $response = $reportErrorsServiceClient->reportErrorEvent($formattedProjectName, $event); 54 | * } finally { 55 | * $reportErrorsServiceClient->close(); 56 | * } 57 | * ``` 58 | * 59 | * Many parameters require resource names to be formatted in a particular way. To 60 | * assist with these names, this class includes a format method for each type of 61 | * name, and additionally a parseName method to extract the individual identifiers 62 | * contained within formatted names that are returned by the API. 63 | * 64 | * @experimental 65 | * 66 | * @deprecated Please use the new service client {@see \Google\Cloud\ErrorReporting\V1beta1\Client\ReportErrorsServiceClient}. 67 | */ 68 | class ReportErrorsServiceGapicClient 69 | { 70 | use GapicClientTrait; 71 | 72 | /** The name of the service. */ 73 | const SERVICE_NAME = 'google.devtools.clouderrorreporting.v1beta1.ReportErrorsService'; 74 | 75 | /** 76 | * The default address of the service. 77 | * 78 | * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. 79 | */ 80 | const SERVICE_ADDRESS = 'clouderrorreporting.googleapis.com'; 81 | 82 | /** The address template of the service. */ 83 | private const SERVICE_ADDRESS_TEMPLATE = 'clouderrorreporting.UNIVERSE_DOMAIN'; 84 | 85 | /** The default port of the service. */ 86 | const DEFAULT_SERVICE_PORT = 443; 87 | 88 | /** The name of the code generator, to be included in the agent header. */ 89 | const CODEGEN_NAME = 'gapic'; 90 | 91 | /** The default scopes required by the service. */ 92 | public static $serviceScopes = [ 93 | 'https://www.googleapis.com/auth/cloud-platform', 94 | ]; 95 | 96 | private static $projectNameTemplate; 97 | 98 | private static $pathTemplateMap; 99 | 100 | private static function getClientDefaults() 101 | { 102 | return [ 103 | 'serviceName' => self::SERVICE_NAME, 104 | 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, 105 | 'clientConfig' => __DIR__ . '/../resources/report_errors_service_client_config.json', 106 | 'descriptorsConfigPath' => __DIR__ . '/../resources/report_errors_service_descriptor_config.php', 107 | 'gcpApiConfigPath' => __DIR__ . '/../resources/report_errors_service_grpc_config.json', 108 | 'credentialsConfig' => [ 109 | 'defaultScopes' => self::$serviceScopes, 110 | ], 111 | 'transportConfig' => [ 112 | 'rest' => [ 113 | 'restClientConfigPath' => __DIR__ . '/../resources/report_errors_service_rest_client_config.php', 114 | ], 115 | ], 116 | ]; 117 | } 118 | 119 | private static function getProjectNameTemplate() 120 | { 121 | if (self::$projectNameTemplate == null) { 122 | self::$projectNameTemplate = new PathTemplate('projects/{project}'); 123 | } 124 | 125 | return self::$projectNameTemplate; 126 | } 127 | 128 | private static function getPathTemplateMap() 129 | { 130 | if (self::$pathTemplateMap == null) { 131 | self::$pathTemplateMap = [ 132 | 'project' => self::getProjectNameTemplate(), 133 | ]; 134 | } 135 | 136 | return self::$pathTemplateMap; 137 | } 138 | 139 | /** 140 | * Formats a string containing the fully-qualified path to represent a project 141 | * resource. 142 | * 143 | * @param string $project 144 | * 145 | * @return string The formatted project resource. 146 | * 147 | * @experimental 148 | */ 149 | public static function projectName($project) 150 | { 151 | return self::getProjectNameTemplate()->render([ 152 | 'project' => $project, 153 | ]); 154 | } 155 | 156 | /** 157 | * Parses a formatted name string and returns an associative array of the components in the name. 158 | * The following name formats are supported: 159 | * Template: Pattern 160 | * - project: projects/{project} 161 | * 162 | * The optional $template argument can be supplied to specify a particular pattern, 163 | * and must match one of the templates listed above. If no $template argument is 164 | * provided, or if the $template argument does not match one of the templates 165 | * listed, then parseName will check each of the supported templates, and return 166 | * the first match. 167 | * 168 | * @param string $formattedName The formatted name string 169 | * @param string $template Optional name of template to match 170 | * 171 | * @return array An associative array from name component IDs to component values. 172 | * 173 | * @throws ValidationException If $formattedName could not be matched. 174 | * 175 | * @experimental 176 | */ 177 | public static function parseName($formattedName, $template = null) 178 | { 179 | $templateMap = self::getPathTemplateMap(); 180 | if ($template) { 181 | if (!isset($templateMap[$template])) { 182 | throw new ValidationException("Template name $template does not exist"); 183 | } 184 | 185 | return $templateMap[$template]->match($formattedName); 186 | } 187 | 188 | foreach ($templateMap as $templateName => $pathTemplate) { 189 | try { 190 | return $pathTemplate->match($formattedName); 191 | } catch (ValidationException $ex) { 192 | // Swallow the exception to continue trying other path templates 193 | } 194 | } 195 | 196 | throw new ValidationException("Input did not match any known format. Input: $formattedName"); 197 | } 198 | 199 | /** 200 | * Constructor. 201 | * 202 | * @param array $options { 203 | * Optional. Options for configuring the service API wrapper. 204 | * 205 | * @type string $apiEndpoint 206 | * The address of the API remote host. May optionally include the port, formatted 207 | * as ":". Default 'clouderrorreporting.googleapis.com:443'. 208 | * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials 209 | * The credentials to be used by the client to authorize API calls. This option 210 | * accepts either a path to a credentials file, or a decoded credentials file as a 211 | * PHP array. 212 | * *Advanced usage*: In addition, this option can also accept a pre-constructed 213 | * {@see \Google\Auth\FetchAuthTokenInterface} object or 214 | * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these 215 | * objects are provided, any settings in $credentialsConfig will be ignored. 216 | * @type array $credentialsConfig 217 | * Options used to configure credentials, including auth token caching, for the 218 | * client. For a full list of supporting configuration options, see 219 | * {@see \Google\ApiCore\CredentialsWrapper::build()} . 220 | * @type bool $disableRetries 221 | * Determines whether or not retries defined by the client configuration should be 222 | * disabled. Defaults to `false`. 223 | * @type string|array $clientConfig 224 | * Client method configuration, including retry settings. This option can be either 225 | * a path to a JSON file, or a PHP array containing the decoded JSON data. By 226 | * default this settings points to the default client config file, which is 227 | * provided in the resources folder. 228 | * @type string|TransportInterface $transport 229 | * The transport used for executing network requests. May be either the string 230 | * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. 231 | * *Advanced usage*: Additionally, it is possible to pass in an already 232 | * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note 233 | * that when this object is provided, any settings in $transportConfig, and any 234 | * $apiEndpoint setting, will be ignored. 235 | * @type array $transportConfig 236 | * Configuration options that will be used to construct the transport. Options for 237 | * each supported transport type should be passed in a key for that transport. For 238 | * example: 239 | * $transportConfig = [ 240 | * 'grpc' => [...], 241 | * 'rest' => [...], 242 | * ]; 243 | * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and 244 | * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the 245 | * supported options. 246 | * @type callable $clientCertSource 247 | * A callable which returns the client cert as a string. This can be used to 248 | * provide a certificate and private key to the transport layer for mTLS. 249 | * } 250 | * 251 | * @throws ValidationException 252 | * 253 | * @experimental 254 | */ 255 | public function __construct(array $options = []) 256 | { 257 | $clientOptions = $this->buildClientOptions($options); 258 | $this->setClientOptions($clientOptions); 259 | } 260 | 261 | /** 262 | * Report an individual error event and record the event to a log. 263 | * 264 | * This endpoint accepts **either** an OAuth token, 265 | * **or** an [API key](https://support.google.com/cloud/answer/6158862) 266 | * for authentication. To use an API key, append it to the URL as the value of 267 | * a `key` parameter. For example: 268 | * 269 | * `POST 270 | * https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events:report?key=123ABC456` 271 | * 272 | * **Note:** [Error Reporting] (https://cloud.google.com/error-reporting) 273 | * is a service built on Cloud Logging and can analyze log entries when all of 274 | * the following are true: 275 | * 276 | * * Customer-managed encryption keys (CMEK) are disabled on the log bucket. 277 | * * The log bucket satisfies one of the following: 278 | * * The log bucket is stored in the same project where the logs 279 | * originated. 280 | * * The logs were routed to a project, and then that project stored those 281 | * logs in a log bucket that it owns. 282 | * 283 | * Sample code: 284 | * ``` 285 | * $reportErrorsServiceClient = new ReportErrorsServiceClient(); 286 | * try { 287 | * $formattedProjectName = $reportErrorsServiceClient->projectName('[PROJECT]'); 288 | * $event = new ReportedErrorEvent(); 289 | * $response = $reportErrorsServiceClient->reportErrorEvent($formattedProjectName, $event); 290 | * } finally { 291 | * $reportErrorsServiceClient->close(); 292 | * } 293 | * ``` 294 | * 295 | * @param string $projectName Required. The resource name of the Google Cloud Platform project. Written 296 | * as `projects/{projectId}`, where `{projectId}` is the 297 | * [Google Cloud Platform project 298 | * ID](https://support.google.com/cloud/answer/6158840). 299 | * 300 | * Example: // `projects/my-project-123`. 301 | * @param ReportedErrorEvent $event Required. The error event to be reported. 302 | * @param array $optionalArgs { 303 | * Optional. 304 | * 305 | * @type RetrySettings|array $retrySettings 306 | * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an 307 | * associative array of retry settings parameters. See the documentation on 308 | * {@see RetrySettings} for example usage. 309 | * } 310 | * 311 | * @return \Google\Cloud\ErrorReporting\V1beta1\ReportErrorEventResponse 312 | * 313 | * @throws ApiException if the remote call fails 314 | * 315 | * @experimental 316 | */ 317 | public function reportErrorEvent($projectName, $event, array $optionalArgs = []) 318 | { 319 | $request = new ReportErrorEventRequest(); 320 | $requestParamHeaders = []; 321 | $request->setProjectName($projectName); 322 | $request->setEvent($event); 323 | $requestParamHeaders['project_name'] = $projectName; 324 | $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); 325 | $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); 326 | return $this->startCall('ReportErrorEvent', ReportErrorEventResponse::class, $optionalArgs, $request)->wait(); 327 | } 328 | } 329 | --------------------------------------------------------------------------------