From 5f5b6126967f8a22435232afa2b2c12b7159c73b Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 5 Feb 2026 17:10:53 +0000 Subject: [PATCH] feat: add google/cloud-auditmanager --- .repo-metadata-full.json | 8 + AuditManager/.OwlBot.yaml | 4 + AuditManager/.gitattributes | 7 + AuditManager/.github/pull_request_template.md | 24 + AuditManager/CONTRIBUTING.md | 10 + AuditManager/LICENSE | 202 ++++ AuditManager/README.md | 73 ++ AuditManager/SECURITY.md | 7 + AuditManager/VERSION | 1 + AuditManager/composer.json | 30 + AuditManager/metadata/V1/Auditmanager.php | Bin 0 -> 11278 bytes AuditManager/owlbot.py | 56 ++ AuditManager/phpunit.xml.dist | 16 + .../V1/AuditManagerClient/enroll_resource.php | 81 ++ .../generate_audit_report.php | 101 ++ .../generate_audit_scope_report.php | 96 ++ .../AuditManagerClient/get_audit_report.php | 73 ++ .../V1/AuditManagerClient/get_location.php | 57 ++ .../get_resource_enrollment_status.php | 78 ++ .../AuditManagerClient/list_audit_reports.php | 76 ++ .../V1/AuditManagerClient/list_controls.php | 78 ++ .../V1/AuditManagerClient/list_locations.php | 69 ++ .../list_resource_enrollment_statuses.php | 77 ++ AuditManager/src/V1/AuditReport.php | 445 +++++++++ .../V1/AuditReport/ReportGenerationState.php | 80 ++ AuditManager/src/V1/AuditScopeReport.php | 113 +++ .../src/V1/Client/AuditManagerClient.php | 877 +++++++++++++++++ AuditManager/src/V1/ComplianceState.php | 82 ++ AuditManager/src/V1/Control.php | 407 ++++++++ AuditManager/src/V1/Control/Family.php | 174 ++++ AuditManager/src/V1/ControlDetails.php | 155 +++ AuditManager/src/V1/ControlFamily.php | 101 ++ AuditManager/src/V1/DestinationDetails.php | 75 ++ AuditManager/src/V1/EnrollResourceRequest.php | 166 ++++ .../EligibleDestination.php | 79 ++ AuditManager/src/V1/Enrollment.php | 105 ++ .../src/V1/GenerateAuditReportRequest.php | 259 +++++ .../AuditReportFormat.php | 55 ++ .../V1/GenerateAuditScopeReportRequest.php | 211 ++++ .../AuditScopeReportFormat.php | 55 ++ AuditManager/src/V1/GetAuditReportRequest.php | 91 ++ .../V1/GetResourceEnrollmentStatusRequest.php | 96 ++ .../src/V1/ListAuditReportsRequest.php | 153 +++ .../src/V1/ListAuditReportsResponse.php | 101 ++ AuditManager/src/V1/ListControlsRequest.php | 163 ++++ AuditManager/src/V1/ListControlsResponse.php | 101 ++ .../ListResourceEnrollmentStatusesRequest.php | 159 +++ ...ListResourceEnrollmentStatusesResponse.php | 101 ++ AuditManager/src/V1/OperationMetadata.php | 307 ++++++ AuditManager/src/V1/OperationState.php | 105 ++ .../src/V1/ReportGenerationProgress.php | 321 ++++++ AuditManager/src/V1/ReportSummary.php | 203 ++++ .../src/V1/ResourceEnrollmentStatus.php | 224 +++++ .../ResourceEnrollmentState.php | 69 ++ AuditManager/src/V1/gapic_metadata.json | 68 ++ .../audit_manager_client_config.json | 94 ++ .../audit_manager_descriptor_config.php | 206 ++++ .../audit_manager_rest_client_config.php | 284 ++++++ .../Unit/V1/Client/AuditManagerClientTest.php | 922 ++++++++++++++++++ composer.json | 3 + 60 files changed, 8434 insertions(+) create mode 100644 AuditManager/.OwlBot.yaml create mode 100644 AuditManager/.gitattributes create mode 100644 AuditManager/.github/pull_request_template.md create mode 100644 AuditManager/CONTRIBUTING.md create mode 100644 AuditManager/LICENSE create mode 100644 AuditManager/README.md create mode 100644 AuditManager/SECURITY.md create mode 100644 AuditManager/VERSION create mode 100644 AuditManager/composer.json create mode 100644 AuditManager/metadata/V1/Auditmanager.php create mode 100644 AuditManager/owlbot.py create mode 100644 AuditManager/phpunit.xml.dist create mode 100644 AuditManager/samples/V1/AuditManagerClient/enroll_resource.php create mode 100644 AuditManager/samples/V1/AuditManagerClient/generate_audit_report.php create mode 100644 AuditManager/samples/V1/AuditManagerClient/generate_audit_scope_report.php create mode 100644 AuditManager/samples/V1/AuditManagerClient/get_audit_report.php create mode 100644 AuditManager/samples/V1/AuditManagerClient/get_location.php create mode 100644 AuditManager/samples/V1/AuditManagerClient/get_resource_enrollment_status.php create mode 100644 AuditManager/samples/V1/AuditManagerClient/list_audit_reports.php create mode 100644 AuditManager/samples/V1/AuditManagerClient/list_controls.php create mode 100644 AuditManager/samples/V1/AuditManagerClient/list_locations.php create mode 100644 AuditManager/samples/V1/AuditManagerClient/list_resource_enrollment_statuses.php create mode 100644 AuditManager/src/V1/AuditReport.php create mode 100644 AuditManager/src/V1/AuditReport/ReportGenerationState.php create mode 100644 AuditManager/src/V1/AuditScopeReport.php create mode 100644 AuditManager/src/V1/Client/AuditManagerClient.php create mode 100644 AuditManager/src/V1/ComplianceState.php create mode 100644 AuditManager/src/V1/Control.php create mode 100644 AuditManager/src/V1/Control/Family.php create mode 100644 AuditManager/src/V1/ControlDetails.php create mode 100644 AuditManager/src/V1/ControlFamily.php create mode 100644 AuditManager/src/V1/DestinationDetails.php create mode 100644 AuditManager/src/V1/EnrollResourceRequest.php create mode 100644 AuditManager/src/V1/EnrollResourceRequest/EligibleDestination.php create mode 100644 AuditManager/src/V1/Enrollment.php create mode 100644 AuditManager/src/V1/GenerateAuditReportRequest.php create mode 100644 AuditManager/src/V1/GenerateAuditReportRequest/AuditReportFormat.php create mode 100644 AuditManager/src/V1/GenerateAuditScopeReportRequest.php create mode 100644 AuditManager/src/V1/GenerateAuditScopeReportRequest/AuditScopeReportFormat.php create mode 100644 AuditManager/src/V1/GetAuditReportRequest.php create mode 100644 AuditManager/src/V1/GetResourceEnrollmentStatusRequest.php create mode 100644 AuditManager/src/V1/ListAuditReportsRequest.php create mode 100644 AuditManager/src/V1/ListAuditReportsResponse.php create mode 100644 AuditManager/src/V1/ListControlsRequest.php create mode 100644 AuditManager/src/V1/ListControlsResponse.php create mode 100644 AuditManager/src/V1/ListResourceEnrollmentStatusesRequest.php create mode 100644 AuditManager/src/V1/ListResourceEnrollmentStatusesResponse.php create mode 100644 AuditManager/src/V1/OperationMetadata.php create mode 100644 AuditManager/src/V1/OperationState.php create mode 100644 AuditManager/src/V1/ReportGenerationProgress.php create mode 100644 AuditManager/src/V1/ReportSummary.php create mode 100644 AuditManager/src/V1/ResourceEnrollmentStatus.php create mode 100644 AuditManager/src/V1/ResourceEnrollmentStatus/ResourceEnrollmentState.php create mode 100644 AuditManager/src/V1/gapic_metadata.json create mode 100644 AuditManager/src/V1/resources/audit_manager_client_config.json create mode 100644 AuditManager/src/V1/resources/audit_manager_descriptor_config.php create mode 100644 AuditManager/src/V1/resources/audit_manager_rest_client_config.php create mode 100644 AuditManager/tests/Unit/V1/Client/AuditManagerClientTest.php diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index 771229c65984..2434cfa8dc3f 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -185,6 +185,14 @@ "library_type": "GAPIC_AUTO", "api_shortname": "assuredworkloads" }, + "AuditManager": { + "language": "php", + "distribution_name": "google/cloud-auditmanager", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-auditmanager/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "auditmanager" + }, "AutoMl": { "language": "php", "distribution_name": "google/cloud-automl", diff --git a/AuditManager/.OwlBot.yaml b/AuditManager/.OwlBot.yaml new file mode 100644 index 000000000000..02510a10bfa3 --- /dev/null +++ b/AuditManager/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/cloud/auditmanager/(v1)/.*-php/(.*) + dest: /owl-bot-staging/AuditManager/$1/$2 +api-name: AuditManager diff --git a/AuditManager/.gitattributes b/AuditManager/.gitattributes new file mode 100644 index 000000000000..4bf0fe6f415b --- /dev/null +++ b/AuditManager/.gitattributes @@ -0,0 +1,7 @@ +/*.xml.dist export-ignore +/.OwlBot.yaml export-ignore +/.github export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore +/samples export-ignore +/tests export-ignore diff --git a/AuditManager/.github/pull_request_template.md b/AuditManager/.github/pull_request_template.md new file mode 100644 index 000000000000..88b6ccd7f6bb --- /dev/null +++ b/AuditManager/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `googleapis/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:googleapis/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `AuditManager/src`, and tests in `AuditManager/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/googleapis/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/AuditManager/CONTRIBUTING.md b/AuditManager/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/AuditManager/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/googleapis/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/AuditManager/LICENSE b/AuditManager/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/AuditManager/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/AuditManager/README.md b/AuditManager/README.md new file mode 100644 index 000000000000..f19c3c23c66e --- /dev/null +++ b/AuditManager/README.md @@ -0,0 +1,73 @@ +# Google Cloud Audit Manager for PHP + +> Idiomatic PHP client for [Google Cloud Audit Manager](https://cloud.google.com/products/audit-manager). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-auditmanager/v/stable)](https://packagist.org/packages/google/cloud-auditmanager) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-auditmanager.svg)](https://packagist.org/packages/google/cloud-auditmanager) + +* [API documentation](https://cloud.google.com/php/docs/reference/cloud-auditmanager/latest) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now, install this component: + +```sh +$ composer require google/cloud-auditmanager +``` + +> Browse the complete list of [Google Cloud APIs](https://cloud.google.com/php/docs/reference) +> for PHP + +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) please see our +[gRPC installation guide](https://cloud.google.com/php/grpc). + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Sample + +```php +use Google\ApiCore\ApiException; +use Google\Cloud\AuditManager\V1\AuditReport; +use Google\Cloud\AuditManager\V1\Client\AuditManagerClient; +use Google\Cloud\AuditManager\V1\GetAuditReportRequest; + +// Create a client. +$auditManagerClient = new AuditManagerClient(); + +// Prepare the request message. +$request = (new GetAuditReportRequest()) + ->setName($formattedName); + +// Call the API and handle any network failures. +try { + /** @var AuditReport $response */ + $response = $auditManagerClient->getAuditReport($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); +} catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); +} +``` + +See the [samples directory](https://github.com/googleapis/google-cloud-php-auditmanager/tree/main/samples) for a canonical list of samples. + +### Debugging + +Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md) +for more information about the debugging tools. + +### Version + +This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. + +### Next Steps + +1. Understand the [official documentation](https://cloud.google.com/audit-manager/docs). diff --git a/AuditManager/SECURITY.md b/AuditManager/SECURITY.md new file mode 100644 index 000000000000..8b58ae9c01ae --- /dev/null +++ b/AuditManager/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/AuditManager/VERSION b/AuditManager/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/AuditManager/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/AuditManager/composer.json b/AuditManager/composer.json new file mode 100644 index 000000000000..486083806132 --- /dev/null +++ b/AuditManager/composer.json @@ -0,0 +1,30 @@ +{ + "name": "google/cloud-auditmanager", + "description": "Google Cloud Audit Manager Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\AuditManager\\": "src", + "GPBMetadata\\Google\\Cloud\\Auditmanager\\": "metadata" + } + }, + "extra": { + "component": { + "id": "cloud-auditmanager", + "path": "AuditManager", + "target": "googleapis/google-cloud-php-auditmanager" + } + }, + "require": { + "php": "^8.1", + "google/gax": "^1.42.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/AuditManager/metadata/V1/Auditmanager.php b/AuditManager/metadata/V1/Auditmanager.php new file mode 100644 index 0000000000000000000000000000000000000000..a86ea1bbecd9308de38e1f18753cea0b6bd17ea0 GIT binary patch literal 11278 zcmbtaO>7&-70!~DEI-*YJ+duDc4B({Co2wV(TSVTR-BbY$#f`^pd<%1SS(iLO5TRz zvb#&Wt|9aXZGoUDatM$f3iQ&Vha8HchoGmTD2lcSilS(X9C9dHG>5{c_E4ZmE`9T} z%OOQBNmrK@cjvu%^UeF8xp}K`zX9jst7hGF49~2_w;sj4`)0i1*q&XnYw@k-_O|K7 zEB0=~s+mqA9$zlR^M#FgW;wfY7D-*Z=~T>ge8;wTYG$%hvzyhV(X3kDu2DC3OegtZ zzU_B{@dl_HyQbSPDrS7OxVUC|M%D0)@+xCfUZQNun#87jcm4)IrDnKpTz(IaA&!5I z=2p$B#9hzu@NwR9b*pZ9mQl05f~#7HZyPn&LHd*%-PFv&XbNk z->?ydg}5(RkphFDl(Tiubm~T}yllD^$7*=CQ^cX^^p5ETaMCxkm&LS{owXgGU@!Qu+yyqRVU@Ld-KHqmbvK=Et*OPL7vWOPGV9)O zG%J=_t1g=NjR%(P3`bfrh3X6}WX`VdIL&(9s_&Ew4XUuiEi%}<4GUGzGjs&T7+!D;VOQ!>U^uFBk}0$cxpAlMd`l!L|68SOwHP{ zwrVDto6nEUF|!7fUA~d$VA2#M`cB2wx0;o=Om8|$g}eRC;uM?+KFcDie~G{uf4iBV zS*MFCnGM_V_ANEiT5237sgtZ(2D%U(wX0q=oGPD>gVBH^4r8Nl+s>}xO&>t&iPT0o z8hvC*bjrBGc=H+0!f{EaZ3jK>L)&?4dL$5A-G-ChIgrb6LEA(pudgo^iW$9>DHci_ z`bwd+rfuk(`SoIEDZ7%*EXST9XW_ZtLkr6*F-83-0yAw(X-D)J9Hg7nbS%^nwnJU@ zsXxfu-9f%H1jucYaeVo!A)(!bV+>lEn4E(%9I7xpPr+2TK@7>oBQP#0tl9u|)kMwY z&Xn8EE_#f0i~&v8*VsF7fW}*4n>W!mKh>_oONJC+1w!a^+yrV(vKLGBhYDQCS#Hlc z&0y9nj5Z7hg%R_<%I3WW^I`LLE`iw}ISGdvm`&&|#&f13BUHr|G6lfid-hvqy=85R z`XdD{_LI_WV30IPxeTX$XQ`XaxlshE5hH}Ai_%lKbv;~%df`P*!_m6=Wlxvn4E#n^ z{f+`tR8C1%0{m`u;Fo0hT_)vAVE{^;hKKE|Fuh+Ifl~&Kuz7WdxiKG?%i*|4;?OON z_QB&WoIrh+hC%?$x`**A0QqJI$X6K17vVfxt4LxyjRUQV z`S;-gcHnrs6aw6vFjf(g34OZ|j;mP5AejC=0@K_J2^Wlc6DC7DsPry*9pg4CI`<6| zsVm{L26-3tFD9S-6ijRzR;}rns2PT9*SQbpAJ4%l^MO%ovJ61Se4|25i-jcjSHp2%ZlyiToQ_GK zemC+&dnW=H!<1E$>UB))zGzlFH~Conx0kHh6`r0YAN&9AC0lL~hqiv~k=M5ETGe#$ zE&pd&`a8C>W7Ms$_*2S1hvYRk-V)4BLFSiq{U7Ct_HPBQgu%OSqWqvBGp>?|2r7G}%X03K++dIo#%=D{zHzBo z=c~nucB4?g7J*}d>HEbxc?rfVXz`w@(=vhKIG&pE6&X=rrE(%Dx46O0!KP7J)~yI1rQ7wubhcO;Eo>P*5f9or7I-e^3$0W)imBI0hu11*Rj<%Ay;fsd zI6aC|jB(+nVH`6c9T~gmgQgEMXF$W2`r}dRM7yV1f$9Xc&lu4_(n#hJ$5XRDHeKsJ zQTfo^g9|f7k)pMh$qR|G#gS=+hR|oRuCm-l&3L4cUiy@3ep@W!4LurKOCX$(IVb+*&4&<-~@zk?ANPVsIFHN@5h26bd;4 zhqC$GnNoHGe@4h*7~?GPS2X?o=o9UG(Wgsa$rlE*Ca1?%n`or|xBbcD9?=IiexFGu zNH}RorTJ#~1lVX9)`33dRC6=E2~*R(zNv2?gmH})7ChzXW*fI*Ld0;lxw~sPkA!`^ z&`(8a6~4|%xQU=8piAeiAl;Jc?P#xXOKs(8!!7AifCdG1v{klJry^{!!%tGDGJw;& z14l(hsQanH7)urUq-Y{Bl+y%a!qol*i>G~uP@0L&)LdA+BF8(z2}^*~&kn#r zK}wE7#2+2lU0VbSa;7K-zEM5_3)X!r3Nb~3i^sX6f2iPS_-4fuWFVaIqIf$28QixdT#vs-Wug?LP@*MO(|}sNTyx zyitf~OK3Cnxq%UvJ~z=&@VTVL4zTB1Y=k|Fu~GWWYO#atS&EI(=b9Ef#Gb_%&}T6d z8)wg4>@a(-$BxivNsCR;=eia<%AQNH7<*=8$JnzJBkBT>{WTAnhKW`)m$eI-24h3F zqb>H10!O$#h;V@xKknhdNDcG;rsznGVEYJtEbrRVqLhB1n#?}nkp|BX#Ru9t9w92s zU{9cld>r$EWj@sFrdg#4B_pQ#HA1H{9mjUWOR7>M>OT~i5DF?>Gr0~2g_?`pd9ae7 z&VQZI(P@ui?cEjjHs;G}PC+$HILP^K&HYjkZW&wUnwiJ(wmlVII- z3LD5Fe!I&6nhj#2SfY*_usv|GlSAgNmfPf^K=%2^X@fOn>~bNWiJc&6xW0c-b~%&B zRCRx>ktcW_4KO(bEt~KRNx};~i8hP5g0`&7v&^ERAMYe!tWsnKPIi6~QSIg&YW>lU zJ;s#fGz)@Rjjpa+_Kmr=KVpMN&AZt`j)9Ag03}(|@|#)?k-3}Ays76inPnD355Y*L zR4SCvJ50eO?^v^q+bq(v0vt1v`X$B|mOQNS(_r#*R1lu>mPCe4u7xXY`)JV)oEf;3 zQh%d-tPz%TTtUa}A0D~i`12?4M&4J{tMq{SG5fyYN8&lDDKfX0<^`26Z(5nVcU_&A z$bu}OFWn9Gxu8EBgoD_N&WAG*PR_Panoj)yK`me6sJ8ne z))&1ZJPAMPVo-leQEy6X?+!J;DIiVc;(0p1n?PY-R2L)`Jzx*#L4F&7$u=~&10%15 zBhZD!$L=|wQaV~q1Wr)>Ncm8Uca%iISHG9?v6kduies=VgMs>3{hS0y7^Zxc?Qkxr zuSnFPaCRXlKf^9t=V1YP*$1P0i=%VAk71v~mHlMAZLa!&LBgUS|WrfY%-J$`E>-Ir*_h7<)%xP!ch;W_JLpi|Ck8F zeXqlCzpV%q1~J^;Km@xX*z_>t-VDeuB5;@jA#!z>%=cffKh}pRH4KRWgr+I7C;LDV zdetA0BzAIG*mcodlOmaS@4ZTRa0r8<2Wgt{$RJ327=71iX9^!`r&tG~``PKAw8VYS zYq;rT^5MgW0;u5DfzkBt^Gk#;Vtd=8`NQISqd+ephGM!nes_M?u;{U-XBU-wx5X8s z9jxK%I|;O^BqkEL4$l^swdj=HuPfe=rGGzidX?QtOt3qN2|1Zf+@1f>|6CS#7Wt(` zk?of8*5Z@M8O|V`W*pLKnMFE{BeZpxljrONWrZEN<-|E1x!@~x=n>o#&4jCATnkbk zIp96t?tdQ3Kf52#J<%Y9QelHUv6gFS%%0cq&_ AX#fBK literal 0 HcmV?d00001 diff --git a/AuditManager/owlbot.py b/AuditManager/owlbot.py new file mode 100644 index 000000000000..174be71f3c47 --- /dev/null +++ b/AuditManager/owlbot.py @@ -0,0 +1,56 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import logging +from pathlib import Path +import subprocess + +import synthtool as s +from synthtool.languages import php +from synthtool import _tracked_paths + +logging.basicConfig(level=logging.DEBUG) + +src = Path(f"../{php.STAGING_DIR}/AuditManager").resolve() +dest = Path().resolve() + +# Added so that we can pass copy_excludes in the owlbot_main() call +_tracked_paths.add(src) + +php.owlbot_main(src=src, dest=dest) + +# remove class_alias code +s.replace( + "src/V*/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.19', + '--', + 'prettier', + '**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) diff --git a/AuditManager/phpunit.xml.dist b/AuditManager/phpunit.xml.dist new file mode 100644 index 000000000000..16667ff123d4 --- /dev/null +++ b/AuditManager/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + src + + + src/V[!a-zA-Z]* + + + + + tests/Unit + + + diff --git a/AuditManager/samples/V1/AuditManagerClient/enroll_resource.php b/AuditManager/samples/V1/AuditManagerClient/enroll_resource.php new file mode 100644 index 000000000000..1a5418fe6f06 --- /dev/null +++ b/AuditManager/samples/V1/AuditManagerClient/enroll_resource.php @@ -0,0 +1,81 @@ +setScope($scope) + ->setDestinations($destinations); + + // Call the API and handle any network failures. + try { + /** @var Enrollment $response */ + $response = $auditManagerClient->enrollResource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $scope = '[SCOPE]'; + + enroll_resource_sample($scope); +} +// [END auditmanager_v1_generated_AuditManager_EnrollResource_sync] diff --git a/AuditManager/samples/V1/AuditManagerClient/generate_audit_report.php b/AuditManager/samples/V1/AuditManagerClient/generate_audit_report.php new file mode 100644 index 000000000000..778e7c321587 --- /dev/null +++ b/AuditManager/samples/V1/AuditManagerClient/generate_audit_report.php @@ -0,0 +1,101 @@ +setScope($scope) + ->setComplianceStandard($complianceStandard) + ->setReportFormat($reportFormat) + ->setComplianceFramework($complianceFramework); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $auditManagerClient->generateAuditReport($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AuditReport $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $scope = '[SCOPE]'; + $complianceStandard = '[COMPLIANCE_STANDARD]'; + $reportFormat = AuditReportFormat::AUDIT_REPORT_FORMAT_UNSPECIFIED; + $complianceFramework = '[COMPLIANCE_FRAMEWORK]'; + + generate_audit_report_sample($scope, $complianceStandard, $reportFormat, $complianceFramework); +} +// [END auditmanager_v1_generated_AuditManager_GenerateAuditReport_sync] diff --git a/AuditManager/samples/V1/AuditManagerClient/generate_audit_scope_report.php b/AuditManager/samples/V1/AuditManagerClient/generate_audit_scope_report.php new file mode 100644 index 000000000000..07796a5927be --- /dev/null +++ b/AuditManager/samples/V1/AuditManagerClient/generate_audit_scope_report.php @@ -0,0 +1,96 @@ +setScope($scope) + ->setComplianceStandard($complianceStandard) + ->setReportFormat($reportFormat) + ->setComplianceFramework($complianceFramework); + + // Call the API and handle any network failures. + try { + /** @var AuditScopeReport $response */ + $response = $auditManagerClient->generateAuditScopeReport($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $scope = '[SCOPE]'; + $complianceStandard = '[COMPLIANCE_STANDARD]'; + $reportFormat = AuditScopeReportFormat::AUDIT_SCOPE_REPORT_FORMAT_UNSPECIFIED; + $complianceFramework = '[COMPLIANCE_FRAMEWORK]'; + + generate_audit_scope_report_sample( + $scope, + $complianceStandard, + $reportFormat, + $complianceFramework + ); +} +// [END auditmanager_v1_generated_AuditManager_GenerateAuditScopeReport_sync] diff --git a/AuditManager/samples/V1/AuditManagerClient/get_audit_report.php b/AuditManager/samples/V1/AuditManagerClient/get_audit_report.php new file mode 100644 index 000000000000..fe898f54cd38 --- /dev/null +++ b/AuditManager/samples/V1/AuditManagerClient/get_audit_report.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AuditReport $response */ + $response = $auditManagerClient->getAuditReport($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AuditManagerClient::auditReportName('[PROJECT]', '[LOCATION]', '[AUDIT_REPORT]'); + + get_audit_report_sample($formattedName); +} +// [END auditmanager_v1_generated_AuditManager_GetAuditReport_sync] diff --git a/AuditManager/samples/V1/AuditManagerClient/get_location.php b/AuditManager/samples/V1/AuditManagerClient/get_location.php new file mode 100644 index 000000000000..1dea4b7c3f71 --- /dev/null +++ b/AuditManager/samples/V1/AuditManagerClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END auditmanager_v1_generated_AuditManager_GetLocation_sync] diff --git a/AuditManager/samples/V1/AuditManagerClient/get_resource_enrollment_status.php b/AuditManager/samples/V1/AuditManagerClient/get_resource_enrollment_status.php new file mode 100644 index 000000000000..5847394ae22a --- /dev/null +++ b/AuditManager/samples/V1/AuditManagerClient/get_resource_enrollment_status.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ResourceEnrollmentStatus $response */ + $response = $auditManagerClient->getResourceEnrollmentStatus($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AuditManagerClient::resourceEnrollmentStatusName( + '[FOLDER]', + '[LOCATION]', + '[RESOURCE_ENROLLMENT_STATUS]' + ); + + get_resource_enrollment_status_sample($formattedName); +} +// [END auditmanager_v1_generated_AuditManager_GetResourceEnrollmentStatus_sync] diff --git a/AuditManager/samples/V1/AuditManagerClient/list_audit_reports.php b/AuditManager/samples/V1/AuditManagerClient/list_audit_reports.php new file mode 100644 index 000000000000..5237cc95bf1d --- /dev/null +++ b/AuditManager/samples/V1/AuditManagerClient/list_audit_reports.php @@ -0,0 +1,76 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $auditManagerClient->listAuditReports($request); + + /** @var AuditReport $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AuditManagerClient::folderLocationName('[FOLDER]', '[LOCATION]'); + + list_audit_reports_sample($formattedParent); +} +// [END auditmanager_v1_generated_AuditManager_ListAuditReports_sync] diff --git a/AuditManager/samples/V1/AuditManagerClient/list_controls.php b/AuditManager/samples/V1/AuditManagerClient/list_controls.php new file mode 100644 index 000000000000..23dad617a496 --- /dev/null +++ b/AuditManager/samples/V1/AuditManagerClient/list_controls.php @@ -0,0 +1,78 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $auditManagerClient->listControls($request); + + /** @var Control $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AuditManagerClient::standardName('[PROJECT]', '[LOCATION]', '[STANDARD]'); + + list_controls_sample($formattedParent); +} +// [END auditmanager_v1_generated_AuditManager_ListControls_sync] diff --git a/AuditManager/samples/V1/AuditManagerClient/list_locations.php b/AuditManager/samples/V1/AuditManagerClient/list_locations.php new file mode 100644 index 000000000000..ccceb62bf8af --- /dev/null +++ b/AuditManager/samples/V1/AuditManagerClient/list_locations.php @@ -0,0 +1,69 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END auditmanager_v1_generated_AuditManager_ListLocations_sync] diff --git a/AuditManager/samples/V1/AuditManagerClient/list_resource_enrollment_statuses.php b/AuditManager/samples/V1/AuditManagerClient/list_resource_enrollment_statuses.php new file mode 100644 index 000000000000..2e9fe28a0ab6 --- /dev/null +++ b/AuditManager/samples/V1/AuditManagerClient/list_resource_enrollment_statuses.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $auditManagerClient->listResourceEnrollmentStatuses($request); + + /** @var ResourceEnrollmentStatus $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AuditManagerClient::enrollmentStatusScopeName('[FOLDER]', '[LOCATION]'); + + list_resource_enrollment_statuses_sample($formattedParent); +} +// [END auditmanager_v1_generated_AuditManager_ListResourceEnrollmentStatuses_sync] diff --git a/AuditManager/src/V1/AuditReport.php b/AuditManager/src/V1/AuditReport.php new file mode 100644 index 000000000000..ab766b971452 --- /dev/null +++ b/AuditManager/src/V1/AuditReport.php @@ -0,0 +1,445 @@ +google.cloud.auditmanager.v1.AuditReport + */ +class AuditReport extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of this Audit Report, in the format of scope given in + * request. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. Report summary with compliance, violation counts etc. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ReportSummary report_summary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $report_summary = null; + /** + * Output only. ClientOperationId + * + * Generated from protobuf field string operation_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $operation_id = ''; + /** + * Output only. The location where the generated report will be uploaded. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.DestinationDetails destination_details = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $destination_details = null; + /** + * Output only. Compliance Standard. + * + * Generated from protobuf field string compliance_standard = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $compliance_standard = ''; + /** + * Output only. The parent scope on which the report was generated. + * + * Generated from protobuf field string scope = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $scope = ''; + /** + * Output only. Creation time of the audit report. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The overall status of controls + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.ControlDetails control_details = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $control_details; + /** + * Output only. The state of Audit Report Generation. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.AuditReport.ReportGenerationState report_generation_state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $report_generation_state = 0; + /** + * Output only. Compliance Framework of Audit Report + * + * Generated from protobuf field string compliance_framework = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $compliance_framework = ''; + /** + * Output only. The ID/ Number for the scope on which the audit report was + * generated. + * + * Generated from protobuf field string scope_id = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $scope_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of this Audit Report, in the format of scope given in + * request. + * @type \Google\Cloud\AuditManager\V1\ReportSummary $report_summary + * Output only. Report summary with compliance, violation counts etc. + * @type string $operation_id + * Output only. ClientOperationId + * @type \Google\Cloud\AuditManager\V1\DestinationDetails $destination_details + * Output only. The location where the generated report will be uploaded. + * @type string $compliance_standard + * Output only. Compliance Standard. + * @type string $scope + * Output only. The parent scope on which the report was generated. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of the audit report. + * @type array<\Google\Cloud\AuditManager\V1\ControlDetails>|\Google\Protobuf\Internal\RepeatedField $control_details + * Output only. The overall status of controls + * @type int $report_generation_state + * Output only. The state of Audit Report Generation. + * @type string $compliance_framework + * Output only. Compliance Framework of Audit Report + * @type string $scope_id + * Output only. The ID/ Number for the scope on which the audit report was + * generated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of this Audit Report, in the format of scope given in + * request. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of this Audit Report, in the format of scope given in + * request. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Report summary with compliance, violation counts etc. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ReportSummary report_summary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AuditManager\V1\ReportSummary|null + */ + public function getReportSummary() + { + return $this->report_summary; + } + + public function hasReportSummary() + { + return isset($this->report_summary); + } + + public function clearReportSummary() + { + unset($this->report_summary); + } + + /** + * Output only. Report summary with compliance, violation counts etc. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ReportSummary report_summary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AuditManager\V1\ReportSummary $var + * @return $this + */ + public function setReportSummary($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AuditManager\V1\ReportSummary::class); + $this->report_summary = $var; + + return $this; + } + + /** + * Output only. ClientOperationId + * + * Generated from protobuf field string operation_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getOperationId() + { + return $this->operation_id; + } + + /** + * Output only. ClientOperationId + * + * Generated from protobuf field string operation_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setOperationId($var) + { + GPBUtil::checkString($var, True); + $this->operation_id = $var; + + return $this; + } + + /** + * Output only. The location where the generated report will be uploaded. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.DestinationDetails destination_details = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AuditManager\V1\DestinationDetails|null + */ + public function getDestinationDetails() + { + return $this->destination_details; + } + + public function hasDestinationDetails() + { + return isset($this->destination_details); + } + + public function clearDestinationDetails() + { + unset($this->destination_details); + } + + /** + * Output only. The location where the generated report will be uploaded. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.DestinationDetails destination_details = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AuditManager\V1\DestinationDetails $var + * @return $this + */ + public function setDestinationDetails($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AuditManager\V1\DestinationDetails::class); + $this->destination_details = $var; + + return $this; + } + + /** + * Output only. Compliance Standard. + * + * Generated from protobuf field string compliance_standard = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getComplianceStandard() + { + return $this->compliance_standard; + } + + /** + * Output only. Compliance Standard. + * + * Generated from protobuf field string compliance_standard = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setComplianceStandard($var) + { + GPBUtil::checkString($var, True); + $this->compliance_standard = $var; + + return $this; + } + + /** + * Output only. The parent scope on which the report was generated. + * + * Generated from protobuf field string scope = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getScope() + { + return $this->scope; + } + + /** + * Output only. The parent scope on which the report was generated. + * + * Generated from protobuf field string scope = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setScope($var) + { + GPBUtil::checkString($var, True); + $this->scope = $var; + + return $this; + } + + /** + * Output only. Creation time of the audit report. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of the audit report. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The overall status of controls + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.ControlDetails control_details = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getControlDetails() + { + return $this->control_details; + } + + /** + * Output only. The overall status of controls + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.ControlDetails control_details = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\AuditManager\V1\ControlDetails>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setControlDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AuditManager\V1\ControlDetails::class); + $this->control_details = $arr; + + return $this; + } + + /** + * Output only. The state of Audit Report Generation. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.AuditReport.ReportGenerationState report_generation_state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getReportGenerationState() + { + return $this->report_generation_state; + } + + /** + * Output only. The state of Audit Report Generation. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.AuditReport.ReportGenerationState report_generation_state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setReportGenerationState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AuditManager\V1\AuditReport\ReportGenerationState::class); + $this->report_generation_state = $var; + + return $this; + } + + /** + * Output only. Compliance Framework of Audit Report + * + * Generated from protobuf field string compliance_framework = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getComplianceFramework() + { + return $this->compliance_framework; + } + + /** + * Output only. Compliance Framework of Audit Report + * + * Generated from protobuf field string compliance_framework = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setComplianceFramework($var) + { + GPBUtil::checkString($var, True); + $this->compliance_framework = $var; + + return $this; + } + + /** + * Output only. The ID/ Number for the scope on which the audit report was + * generated. + * + * Generated from protobuf field string scope_id = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getScopeId() + { + return $this->scope_id; + } + + /** + * Output only. The ID/ Number for the scope on which the audit report was + * generated. + * + * Generated from protobuf field string scope_id = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setScopeId($var) + { + GPBUtil::checkString($var, True); + $this->scope_id = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/AuditReport/ReportGenerationState.php b/AuditManager/src/V1/AuditReport/ReportGenerationState.php new file mode 100644 index 000000000000..e16a9df51b64 --- /dev/null +++ b/AuditManager/src/V1/AuditReport/ReportGenerationState.php @@ -0,0 +1,80 @@ +google.cloud.auditmanager.v1.AuditReport.ReportGenerationState + */ +class ReportGenerationState +{ + /** + * Unspecified. Invalid state. + * + * Generated from protobuf enum REPORT_GENERATION_STATE_UNSPECIFIED = 0; + */ + const REPORT_GENERATION_STATE_UNSPECIFIED = 0; + /** + * Audit report generation process is in progress, ie. operation state is + * neither OPERATION_STATE_DONE nor OPERATION_STATE_FAILED. + * + * Generated from protobuf enum IN_PROGRESS = 1; + */ + const IN_PROGRESS = 1; + /** + * Audit report generation process is completed. Operation state is + * OPERATION_STATE_DONE. + * + * Generated from protobuf enum COMPLETED = 2; + */ + const COMPLETED = 2; + /** + * Audit report generation process has failed. Operation state is + * OPERATION_STATE_FAILED. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * Audit report generation process has completed. But report summary is + * unknown. This is valid for older reports. + * + * Generated from protobuf enum SUMMARY_UNKNOWN = 4; + */ + const SUMMARY_UNKNOWN = 4; + + private static $valueToName = [ + self::REPORT_GENERATION_STATE_UNSPECIFIED => 'REPORT_GENERATION_STATE_UNSPECIFIED', + self::IN_PROGRESS => 'IN_PROGRESS', + self::COMPLETED => 'COMPLETED', + self::FAILED => 'FAILED', + self::SUMMARY_UNKNOWN => 'SUMMARY_UNKNOWN', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AuditManager/src/V1/AuditScopeReport.php b/AuditManager/src/V1/AuditScopeReport.php new file mode 100644 index 000000000000..5c56618fa228 --- /dev/null +++ b/AuditManager/src/V1/AuditScopeReport.php @@ -0,0 +1,113 @@ +google.cloud.auditmanager.v1.AuditScopeReport + */ +class AuditScopeReport extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of this Audit Report, in the format of scope given in + * request. + * + * Generated from protobuf field string name = 2 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + protected $audit_report; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $scope_report_contents + * The audit scope report content in byte format. + * @type string $name + * Identifier. The name of this Audit Report, in the format of scope given in + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * The audit scope report content in byte format. + * + * Generated from protobuf field bytes scope_report_contents = 1; + * @return string + */ + public function getScopeReportContents() + { + return $this->readOneof(1); + } + + public function hasScopeReportContents() + { + return $this->hasOneof(1); + } + + /** + * The audit scope report content in byte format. + * + * Generated from protobuf field bytes scope_report_contents = 1; + * @param string $var + * @return $this + */ + public function setScopeReportContents($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Identifier. The name of this Audit Report, in the format of scope given in + * request. + * + * Generated from protobuf field string name = 2 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of this Audit Report, in the format of scope given in + * request. + * + * Generated from protobuf field string name = 2 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * @return string + */ + public function getAuditReport() + { + return $this->whichOneof("audit_report"); + } + +} + diff --git a/AuditManager/src/V1/Client/AuditManagerClient.php b/AuditManager/src/V1/Client/AuditManagerClient.php new file mode 100644 index 000000000000..a58180e86911 --- /dev/null +++ b/AuditManager/src/V1/Client/AuditManagerClient.php @@ -0,0 +1,877 @@ + enrollResourceAsync(EnrollResourceRequest $request, array $optionalArgs = []) + * @method PromiseInterface generateAuditReportAsync(GenerateAuditReportRequest $request, array $optionalArgs = []) + * @method PromiseInterface generateAuditScopeReportAsync(GenerateAuditScopeReportRequest $request, array $optionalArgs = []) + * @method PromiseInterface getAuditReportAsync(GetAuditReportRequest $request, array $optionalArgs = []) + * @method PromiseInterface getResourceEnrollmentStatusAsync(GetResourceEnrollmentStatusRequest $request, array $optionalArgs = []) + * @method PromiseInterface listAuditReportsAsync(ListAuditReportsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listControlsAsync(ListControlsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listResourceEnrollmentStatusesAsync(ListResourceEnrollmentStatusesRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) + */ +final class AuditManagerClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.auditmanager.v1.AuditManager'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'auditmanager.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'auditmanager.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform']; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/audit_manager_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/audit_manager_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/audit_manager_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/audit_manager_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = $this->descriptors[$methodName]['longRunning'] ?? []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + + /** + * Formats a string containing the fully-qualified path to represent a audit_report + * resource. + * + * @param string $project + * @param string $location + * @param string $auditReport + * + * @return string The formatted audit_report resource. + */ + public static function auditReportName(string $project, string $location, string $auditReport): string + { + return self::getPathTemplate('auditReport')->render([ + 'project' => $project, + 'location' => $location, + 'audit_report' => $auditReport, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * enrollment_status_scope resource. + * + * @param string $folder + * @param string $location + * + * @return string The formatted enrollment_status_scope resource. + */ + public static function enrollmentStatusScopeName(string $folder, string $location): string + { + return self::getPathTemplate('enrollmentStatusScope')->render([ + 'folder' => $folder, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location resource. + * + * @param string $folder + * @param string $location + * + * @return string The formatted folder_location resource. + */ + public static function folderLocationName(string $folder, string $location): string + { + return self::getPathTemplate('folderLocation')->render([ + 'folder' => $folder, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_audit_report resource. + * + * @param string $folder + * @param string $location + * @param string $auditReport + * + * @return string The formatted folder_location_audit_report resource. + */ + public static function folderLocationAuditReportName(string $folder, string $location, string $auditReport): string + { + return self::getPathTemplate('folderLocationAuditReport')->render([ + 'folder' => $folder, + 'location' => $location, + 'audit_report' => $auditReport, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_resource_enrollment_status resource. + * + * @param string $folder + * @param string $location + * @param string $resourceEnrollmentStatus + * + * @return string The formatted folder_location_resource_enrollment_status resource. + */ + public static function folderLocationResourceEnrollmentStatusName( + string $folder, + string $location, + string $resourceEnrollmentStatus + ): string { + return self::getPathTemplate('folderLocationResourceEnrollmentStatus')->render([ + 'folder' => $folder, + 'location' => $location, + 'resource_enrollment_status' => $resourceEnrollmentStatus, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_standard resource. + * + * @param string $folder + * @param string $location + * @param string $standard + * + * @return string The formatted folder_location_standard resource. + */ + public static function folderLocationStandardName(string $folder, string $location, string $standard): string + { + return self::getPathTemplate('folderLocationStandard')->render([ + 'folder' => $folder, + 'location' => $location, + 'standard' => $standard, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location resource. + * + * @param string $organization + * @param string $location + * + * @return string The formatted organization_location resource. + */ + public static function organizationLocationName(string $organization, string $location): string + { + return self::getPathTemplate('organizationLocation')->render([ + 'organization' => $organization, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_resource_enrollment_status resource. + * + * @param string $organization + * @param string $location + * @param string $resourceEnrollmentStatus + * + * @return string The formatted organization_location_resource_enrollment_status resource. + */ + public static function organizationLocationResourceEnrollmentStatusName( + string $organization, + string $location, + string $resourceEnrollmentStatus + ): string { + return self::getPathTemplate('organizationLocationResourceEnrollmentStatus')->render([ + 'organization' => $organization, + 'location' => $location, + 'resource_enrollment_status' => $resourceEnrollmentStatus, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_standard resource. + * + * @param string $organization + * @param string $location + * @param string $standard + * + * @return string The formatted organization_location_standard resource. + */ + public static function organizationLocationStandardName( + string $organization, + string $location, + string $standard + ): string { + return self::getPathTemplate('organizationLocationStandard')->render([ + 'organization' => $organization, + 'location' => $location, + 'standard' => $standard, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_audit_report resource. + * + * @param string $project + * @param string $location + * @param string $auditReport + * + * @return string The formatted project_location_audit_report resource. + */ + public static function projectLocationAuditReportName( + string $project, + string $location, + string $auditReport + ): string { + return self::getPathTemplate('projectLocationAuditReport')->render([ + 'project' => $project, + 'location' => $location, + 'audit_report' => $auditReport, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_resource_enrollment_status resource. + * + * @param string $project + * @param string $location + * @param string $resourceEnrollmentStatus + * + * @return string The formatted project_location_resource_enrollment_status resource. + */ + public static function projectLocationResourceEnrollmentStatusName( + string $project, + string $location, + string $resourceEnrollmentStatus + ): string { + return self::getPathTemplate('projectLocationResourceEnrollmentStatus')->render([ + 'project' => $project, + 'location' => $location, + 'resource_enrollment_status' => $resourceEnrollmentStatus, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_standard resource. + * + * @param string $project + * @param string $location + * @param string $standard + * + * @return string The formatted project_location_standard resource. + */ + public static function projectLocationStandardName(string $project, string $location, string $standard): string + { + return self::getPathTemplate('projectLocationStandard')->render([ + 'project' => $project, + 'location' => $location, + 'standard' => $standard, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * resource_enrollment_status resource. + * + * @param string $folder + * @param string $location + * @param string $resourceEnrollmentStatus + * + * @return string The formatted resource_enrollment_status resource. + */ + public static function resourceEnrollmentStatusName( + string $folder, + string $location, + string $resourceEnrollmentStatus + ): string { + return self::getPathTemplate('resourceEnrollmentStatus')->render([ + 'folder' => $folder, + 'location' => $location, + 'resource_enrollment_status' => $resourceEnrollmentStatus, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a standard + * resource. + * + * @param string $project + * @param string $location + * @param string $standard + * + * @return string The formatted standard resource. + */ + public static function standardName(string $project, string $location, string $standard): string + { + return self::getPathTemplate('standard')->render([ + 'project' => $project, + 'location' => $location, + 'standard' => $standard, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - auditReport: projects/{project}/locations/{location}/auditReports/{audit_report} + * - enrollmentStatusScope: folders/{folder}/locations/{location} + * - folderLocation: folders/{folder}/locations/{location} + * - folderLocationAuditReport: folders/{folder}/locations/{location}/auditReports/{audit_report} + * - folderLocationResourceEnrollmentStatus: folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status} + * - folderLocationStandard: folders/{folder}/locations/{location}/standards/{standard} + * - location: projects/{project}/locations/{location} + * - organizationLocation: organizations/{organization}/locations/{location} + * - organizationLocationResourceEnrollmentStatus: organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status} + * - organizationLocationStandard: organizations/{organization}/locations/{location}/standards/{standard} + * - projectLocationAuditReport: projects/{project}/locations/{location}/auditReports/{audit_report} + * - projectLocationResourceEnrollmentStatus: projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status} + * - projectLocationStandard: projects/{project}/locations/{location}/standards/{standard} + * - resourceEnrollmentStatus: folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status} + * - standard: projects/{project}/locations/{location}/standards/{standard} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array|ClientOptions $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'auditmanager.googleapis.com:443'. + * @type FetchAuthTokenInterface|CredentialsWrapper $credentials + * This option should only be used with a pre-constructed + * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that + * when one of these objects are provided, any settings in $credentialsConfig will + * be ignored. + * **Important**: If you are providing a path to a credentials file, or a decoded + * credentials file as a PHP array, this usage is now DEPRECATED. Providing an + * unvalidated credential configuration to Google APIs can compromise the security + * of your systems and data. It is recommended to create the credentials explicitly + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * use Google\Cloud\AuditManager\V1\AuditManagerClient; + * $creds = new ServiceAccountCredentials($scopes, $json); + * $options = new AuditManagerClient(['credentials' => $creds]); + * ``` + * {@see + * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * @type string $universeDomain + * The service domain for the client. Defaults to 'googleapis.com'. + * } + * + * @throws ValidationException + */ + public function __construct(array|ClientOptions $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Enrolls the customer resource(folder/project/organization) to the audit + * manager service by creating the audit managers Service Agent in customers + * workload and granting required permissions to the Service Agent. Please + * note that if enrollment request is made on the already enrolled workload + * then enrollment is executed overriding the existing set of destinations. + * + * The async variant is {@see AuditManagerClient::enrollResourceAsync()} . + * + * @example samples/V1/AuditManagerClient/enroll_resource.php + * + * @param EnrollResourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Enrollment + * + * @throws ApiException Thrown if the API call fails. + */ + public function enrollResource(EnrollResourceRequest $request, array $callOptions = []): Enrollment + { + return $this->startApiCall('EnrollResource', $request, $callOptions)->wait(); + } + + /** + * Register the Audit Report generation requests and returns the OperationId + * using which the customer can track the report generation progress. + * + * The async variant is {@see AuditManagerClient::generateAuditReportAsync()} . + * + * @example samples/V1/AuditManagerClient/generate_audit_report.php + * + * @param GenerateAuditReportRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateAuditReport(GenerateAuditReportRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('GenerateAuditReport', $request, $callOptions)->wait(); + } + + /** + * Generates a demo report highlighting different responsibilities + * (Google/Customer/ shared) required to be fulfilled for the customer's + * workload to be compliant with the given standard. + * + * The async variant is {@see AuditManagerClient::generateAuditScopeReportAsync()} + * . + * + * @example samples/V1/AuditManagerClient/generate_audit_scope_report.php + * + * @param GenerateAuditScopeReportRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return AuditScopeReport + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateAuditScopeReport( + GenerateAuditScopeReportRequest $request, + array $callOptions = [] + ): AuditScopeReport { + return $this->startApiCall('GenerateAuditScopeReport', $request, $callOptions)->wait(); + } + + /** + * Get the overall audit report + * + * The async variant is {@see AuditManagerClient::getAuditReportAsync()} . + * + * @example samples/V1/AuditManagerClient/get_audit_report.php + * + * @param GetAuditReportRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return AuditReport + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAuditReport(GetAuditReportRequest $request, array $callOptions = []): AuditReport + { + return $this->startApiCall('GetAuditReport', $request, $callOptions)->wait(); + } + + /** + * Get a resource along with its enrollment status. + * + * The async variant is + * {@see AuditManagerClient::getResourceEnrollmentStatusAsync()} . + * + * @example samples/V1/AuditManagerClient/get_resource_enrollment_status.php + * + * @param GetResourceEnrollmentStatusRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ResourceEnrollmentStatus + * + * @throws ApiException Thrown if the API call fails. + */ + public function getResourceEnrollmentStatus( + GetResourceEnrollmentStatusRequest $request, + array $callOptions = [] + ): ResourceEnrollmentStatus { + return $this->startApiCall('GetResourceEnrollmentStatus', $request, $callOptions)->wait(); + } + + /** + * Lists audit reports in the selected parent scope + * + * The async variant is {@see AuditManagerClient::listAuditReportsAsync()} . + * + * @example samples/V1/AuditManagerClient/list_audit_reports.php + * + * @param ListAuditReportsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listAuditReports(ListAuditReportsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAuditReports', $request, $callOptions); + } + + /** + * Gets controls needed to be implemented to be compliant to a standard. + * + * The async variant is {@see AuditManagerClient::listControlsAsync()} . + * + * @example samples/V1/AuditManagerClient/list_controls.php + * + * @param ListControlsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listControls(ListControlsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListControls', $request, $callOptions); + } + + /** + * Fetches all resources under the parent along with their enrollment. + * + * The async variant is + * {@see AuditManagerClient::listResourceEnrollmentStatusesAsync()} . + * + * @example samples/V1/AuditManagerClient/list_resource_enrollment_statuses.php + * + * @param ListResourceEnrollmentStatusesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listResourceEnrollmentStatuses( + ListResourceEnrollmentStatusesRequest $request, + array $callOptions = [] + ): PagedListResponse { + return $this->startApiCall('ListResourceEnrollmentStatuses', $request, $callOptions); + } + + /** + * Gets information about a location. + * + * The async variant is {@see AuditManagerClient::getLocationAsync()} . + * + * @example samples/V1/AuditManagerClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + This method can be called in two ways: + + * **List all public locations:** Use the path `GET /v1/locations`. + * **List project-visible locations:** Use the path + `GET /v1/projects/{project_id}/locations`. This may include public + locations as well as private or other locations specifically visible + to the project. + * + * The async variant is {@see AuditManagerClient::listLocationsAsync()} . + * + * @example samples/V1/AuditManagerClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/AuditManager/src/V1/ComplianceState.php b/AuditManager/src/V1/ComplianceState.php new file mode 100644 index 000000000000..d8dcc8141bf7 --- /dev/null +++ b/AuditManager/src/V1/ComplianceState.php @@ -0,0 +1,82 @@ +google.cloud.auditmanager.v1.ComplianceState + */ +class ComplianceState +{ + /** + * Unspecified. Invalid state. + * + * Generated from protobuf enum COMPLIANCE_STATE_UNSPECIFIED = 0; + */ + const COMPLIANCE_STATE_UNSPECIFIED = 0; + /** + * Compliant. + * + * Generated from protobuf enum COMPLIANT = 1; + */ + const COMPLIANT = 1; + /** + * Violation. + * + * Generated from protobuf enum VIOLATION = 2; + */ + const VIOLATION = 2; + /** + * MANUAL_REVIEW_NEEDED, requires manual review + * + * Generated from protobuf enum MANUAL_REVIEW_NEEDED = 3; + */ + const MANUAL_REVIEW_NEEDED = 3; + /** + * Error while computing status. + * + * Generated from protobuf enum ERROR = 4; + */ + const ERROR = 4; + /** + * Cannot be audited + * + * Generated from protobuf enum AUDIT_NOT_SUPPORTED = 5; + */ + const AUDIT_NOT_SUPPORTED = 5; + + private static $valueToName = [ + self::COMPLIANCE_STATE_UNSPECIFIED => 'COMPLIANCE_STATE_UNSPECIFIED', + self::COMPLIANT => 'COMPLIANT', + self::VIOLATION => 'VIOLATION', + self::MANUAL_REVIEW_NEEDED => 'MANUAL_REVIEW_NEEDED', + self::ERROR => 'ERROR', + self::AUDIT_NOT_SUPPORTED => 'AUDIT_NOT_SUPPORTED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/AuditManager/src/V1/Control.php b/AuditManager/src/V1/Control.php new file mode 100644 index 000000000000..cb413048b6f8 --- /dev/null +++ b/AuditManager/src/V1/Control.php @@ -0,0 +1,407 @@ +google.cloud.auditmanager.v1.Control + */ +class Control extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The control identifier used to fetch the findings. This is + * same as the control report name. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $id = ''; + /** + * Output only. Display name of the control. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $display_name = ''; + /** + * Output only. Group where the control belongs. E.g. Access Control. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.Control.Family family = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $family = 0; + /** + * Output only. Regulatory Family of the control E.g. Access Control + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ControlFamily control_family = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $control_family = null; + /** + * Output only. Regulatory control ask of the control + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $description = ''; + /** + * Output only. The type of responsibility for implementing this control. It + * can be google, customer or shared. + * + * Generated from protobuf field string responsibility_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $responsibility_type = ''; + /** + * Output only. Description of the google responsibility for implementing this + * control. + * + * Generated from protobuf field string google_responsibility_description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $google_responsibility_description = ''; + /** + * Output only. Implementation of the google responsibility for implementing + * this control. + * + * Generated from protobuf field string google_responsibility_implementation = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $google_responsibility_implementation = ''; + /** + * Output only. Description of the customer responsibility for implementing + * this control. + * + * Generated from protobuf field string customer_responsibility_description = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $customer_responsibility_description = ''; + /** + * Output only. Implementation of the customer responsibility for implementing + * this control. + * + * Generated from protobuf field string customer_responsibility_implementation = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $customer_responsibility_implementation = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * Output only. The control identifier used to fetch the findings. This is + * same as the control report name. + * @type string $display_name + * Output only. Display name of the control. + * @type int $family + * Output only. Group where the control belongs. E.g. Access Control. + * @type \Google\Cloud\AuditManager\V1\ControlFamily $control_family + * Output only. Regulatory Family of the control E.g. Access Control + * @type string $description + * Output only. Regulatory control ask of the control + * @type string $responsibility_type + * Output only. The type of responsibility for implementing this control. It + * can be google, customer or shared. + * @type string $google_responsibility_description + * Output only. Description of the google responsibility for implementing this + * control. + * @type string $google_responsibility_implementation + * Output only. Implementation of the google responsibility for implementing + * this control. + * @type string $customer_responsibility_description + * Output only. Description of the customer responsibility for implementing + * this control. + * @type string $customer_responsibility_implementation + * Output only. Implementation of the customer responsibility for implementing + * this control. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The control identifier used to fetch the findings. This is + * same as the control report name. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Output only. The control identifier used to fetch the findings. This is + * same as the control report name. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Output only. Display name of the control. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Output only. Display name of the control. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. Group where the control belongs. E.g. Access Control. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.Control.Family family = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getFamily() + { + return $this->family; + } + + /** + * Output only. Group where the control belongs. E.g. Access Control. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.Control.Family family = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setFamily($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AuditManager\V1\Control\Family::class); + $this->family = $var; + + return $this; + } + + /** + * Output only. Regulatory Family of the control E.g. Access Control + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ControlFamily control_family = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AuditManager\V1\ControlFamily|null + */ + public function getControlFamily() + { + return $this->control_family; + } + + public function hasControlFamily() + { + return isset($this->control_family); + } + + public function clearControlFamily() + { + unset($this->control_family); + } + + /** + * Output only. Regulatory Family of the control E.g. Access Control + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ControlFamily control_family = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AuditManager\V1\ControlFamily $var + * @return $this + */ + public function setControlFamily($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AuditManager\V1\ControlFamily::class); + $this->control_family = $var; + + return $this; + } + + /** + * Output only. Regulatory control ask of the control + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Output only. Regulatory control ask of the control + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The type of responsibility for implementing this control. It + * can be google, customer or shared. + * + * Generated from protobuf field string responsibility_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getResponsibilityType() + { + return $this->responsibility_type; + } + + /** + * Output only. The type of responsibility for implementing this control. It + * can be google, customer or shared. + * + * Generated from protobuf field string responsibility_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setResponsibilityType($var) + { + GPBUtil::checkString($var, True); + $this->responsibility_type = $var; + + return $this; + } + + /** + * Output only. Description of the google responsibility for implementing this + * control. + * + * Generated from protobuf field string google_responsibility_description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getGoogleResponsibilityDescription() + { + return $this->google_responsibility_description; + } + + /** + * Output only. Description of the google responsibility for implementing this + * control. + * + * Generated from protobuf field string google_responsibility_description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setGoogleResponsibilityDescription($var) + { + GPBUtil::checkString($var, True); + $this->google_responsibility_description = $var; + + return $this; + } + + /** + * Output only. Implementation of the google responsibility for implementing + * this control. + * + * Generated from protobuf field string google_responsibility_implementation = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getGoogleResponsibilityImplementation() + { + return $this->google_responsibility_implementation; + } + + /** + * Output only. Implementation of the google responsibility for implementing + * this control. + * + * Generated from protobuf field string google_responsibility_implementation = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setGoogleResponsibilityImplementation($var) + { + GPBUtil::checkString($var, True); + $this->google_responsibility_implementation = $var; + + return $this; + } + + /** + * Output only. Description of the customer responsibility for implementing + * this control. + * + * Generated from protobuf field string customer_responsibility_description = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getCustomerResponsibilityDescription() + { + return $this->customer_responsibility_description; + } + + /** + * Output only. Description of the customer responsibility for implementing + * this control. + * + * Generated from protobuf field string customer_responsibility_description = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setCustomerResponsibilityDescription($var) + { + GPBUtil::checkString($var, True); + $this->customer_responsibility_description = $var; + + return $this; + } + + /** + * Output only. Implementation of the customer responsibility for implementing + * this control. + * + * Generated from protobuf field string customer_responsibility_implementation = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getCustomerResponsibilityImplementation() + { + return $this->customer_responsibility_implementation; + } + + /** + * Output only. Implementation of the customer responsibility for implementing + * this control. + * + * Generated from protobuf field string customer_responsibility_implementation = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setCustomerResponsibilityImplementation($var) + { + GPBUtil::checkString($var, True); + $this->customer_responsibility_implementation = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/Control/Family.php b/AuditManager/src/V1/Control/Family.php new file mode 100644 index 000000000000..d9bbcaa999a9 --- /dev/null +++ b/AuditManager/src/V1/Control/Family.php @@ -0,0 +1,174 @@ +google.cloud.auditmanager.v1.Control.Family + */ +class Family +{ + /** + * Unspecified. Invalid state. + * + * Generated from protobuf enum FAMILY_UNSPECIFIED = 0; + */ + const FAMILY_UNSPECIFIED = 0; + /** + * Access Control + * + * Generated from protobuf enum AC = 1; + */ + const AC = 1; + /** + * Awareness and Training + * + * Generated from protobuf enum AT = 2; + */ + const AT = 2; + /** + * Audit and Accountability + * + * Generated from protobuf enum AU = 3; + */ + const AU = 3; + /** + * Certification, Accreditation and Security Assessments + * + * Generated from protobuf enum CA = 4; + */ + const CA = 4; + /** + * Configuration Management + * + * Generated from protobuf enum CM = 5; + */ + const CM = 5; + /** + * Contingency Planning + * + * Generated from protobuf enum CP = 6; + */ + const CP = 6; + /** + * Identification and Authentication + * + * Generated from protobuf enum IA = 7; + */ + const IA = 7; + /** + * Incident Response + * + * Generated from protobuf enum IR = 8; + */ + const IR = 8; + /** + * Maintenance + * + * Generated from protobuf enum MA = 9; + */ + const MA = 9; + /** + * Media Protection + * + * Generated from protobuf enum MP = 10; + */ + const MP = 10; + /** + * Physical and Environmental Protection + * + * Generated from protobuf enum PE = 11; + */ + const PE = 11; + /** + * Security Planning + * + * Generated from protobuf enum PL = 12; + */ + const PL = 12; + /** + * Personnel Security + * + * Generated from protobuf enum PS = 13; + */ + const PS = 13; + /** + * Risk Assessment + * + * Generated from protobuf enum RA = 14; + */ + const RA = 14; + /** + * System Services and Acquisition + * + * Generated from protobuf enum SA = 15; + */ + const SA = 15; + /** + * System and Communications Protection + * + * Generated from protobuf enum SC = 16; + */ + const SC = 16; + /** + * System and Information Integrity + * + * Generated from protobuf enum SI = 17; + */ + const SI = 17; + /** + * Supply Chain Risk Management + * + * Generated from protobuf enum SR = 18; + */ + const SR = 18; + + private static $valueToName = [ + self::FAMILY_UNSPECIFIED => 'FAMILY_UNSPECIFIED', + self::AC => 'AC', + self::AT => 'AT', + self::AU => 'AU', + self::CA => 'CA', + self::CM => 'CM', + self::CP => 'CP', + self::IA => 'IA', + self::IR => 'IR', + self::MA => 'MA', + self::MP => 'MP', + self::PE => 'PE', + self::PL => 'PL', + self::PS => 'PS', + self::RA => 'RA', + self::SA => 'SA', + self::SC => 'SC', + self::SI => 'SI', + self::SR => 'SR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AuditManager/src/V1/ControlDetails.php b/AuditManager/src/V1/ControlDetails.php new file mode 100644 index 000000000000..a4f89ebca3ab --- /dev/null +++ b/AuditManager/src/V1/ControlDetails.php @@ -0,0 +1,155 @@ +google.cloud.auditmanager.v1.ControlDetails + */ +class ControlDetails extends \Google\Protobuf\Internal\Message +{ + /** + * The control for which the findings are being reported. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.Control control = 1; + */ + protected $control = null; + /** + * Output only. Overall status of the findings for the control. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ComplianceState compliance_state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $compliance_state = 0; + /** + * Report summary with compliance, violation counts etc. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ReportSummary control_report_summary = 3; + */ + protected $control_report_summary = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AuditManager\V1\Control $control + * The control for which the findings are being reported. + * @type int $compliance_state + * Output only. Overall status of the findings for the control. + * @type \Google\Cloud\AuditManager\V1\ReportSummary $control_report_summary + * Report summary with compliance, violation counts etc. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * The control for which the findings are being reported. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.Control control = 1; + * @return \Google\Cloud\AuditManager\V1\Control|null + */ + public function getControl() + { + return $this->control; + } + + public function hasControl() + { + return isset($this->control); + } + + public function clearControl() + { + unset($this->control); + } + + /** + * The control for which the findings are being reported. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.Control control = 1; + * @param \Google\Cloud\AuditManager\V1\Control $var + * @return $this + */ + public function setControl($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AuditManager\V1\Control::class); + $this->control = $var; + + return $this; + } + + /** + * Output only. Overall status of the findings for the control. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ComplianceState compliance_state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getComplianceState() + { + return $this->compliance_state; + } + + /** + * Output only. Overall status of the findings for the control. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ComplianceState compliance_state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setComplianceState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AuditManager\V1\ComplianceState::class); + $this->compliance_state = $var; + + return $this; + } + + /** + * Report summary with compliance, violation counts etc. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ReportSummary control_report_summary = 3; + * @return \Google\Cloud\AuditManager\V1\ReportSummary|null + */ + public function getControlReportSummary() + { + return $this->control_report_summary; + } + + public function hasControlReportSummary() + { + return isset($this->control_report_summary); + } + + public function clearControlReportSummary() + { + unset($this->control_report_summary); + } + + /** + * Report summary with compliance, violation counts etc. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ReportSummary control_report_summary = 3; + * @param \Google\Cloud\AuditManager\V1\ReportSummary $var + * @return $this + */ + public function setControlReportSummary($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AuditManager\V1\ReportSummary::class); + $this->control_report_summary = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/ControlFamily.php b/AuditManager/src/V1/ControlFamily.php new file mode 100644 index 000000000000..0215080003f9 --- /dev/null +++ b/AuditManager/src/V1/ControlFamily.php @@ -0,0 +1,101 @@ +google.cloud.auditmanager.v1.ControlFamily + */ +class ControlFamily extends \Google\Protobuf\Internal\Message +{ + /** + * The ID of the regulatory control family. + * + * Generated from protobuf field string family_id = 1; + */ + protected $family_id = ''; + /** + * The display name of the regulatory control family. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $family_id + * The ID of the regulatory control family. + * @type string $display_name + * The display name of the regulatory control family. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * The ID of the regulatory control family. + * + * Generated from protobuf field string family_id = 1; + * @return string + */ + public function getFamilyId() + { + return $this->family_id; + } + + /** + * The ID of the regulatory control family. + * + * Generated from protobuf field string family_id = 1; + * @param string $var + * @return $this + */ + public function setFamilyId($var) + { + GPBUtil::checkString($var, True); + $this->family_id = $var; + + return $this; + } + + /** + * The display name of the regulatory control family. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The display name of the regulatory control family. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/DestinationDetails.php b/AuditManager/src/V1/DestinationDetails.php new file mode 100644 index 000000000000..9415399f0c85 --- /dev/null +++ b/AuditManager/src/V1/DestinationDetails.php @@ -0,0 +1,75 @@ +google.cloud.auditmanager.v1.DestinationDetails + */ +class DestinationDetails extends \Google\Protobuf\Internal\Message +{ + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gcs_bucket_uri + * The Cloud Storage bucket where the audit report is/will be uploaded. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * The Cloud Storage bucket where the audit report is/will be uploaded. + * + * Generated from protobuf field string gcs_bucket_uri = 1; + * @return string + */ + public function getGcsBucketUri() + { + return $this->readOneof(1); + } + + public function hasGcsBucketUri() + { + return $this->hasOneof(1); + } + + /** + * The Cloud Storage bucket where the audit report is/will be uploaded. + * + * Generated from protobuf field string gcs_bucket_uri = 1; + * @param string $var + * @return $this + */ + public function setGcsBucketUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/AuditManager/src/V1/EnrollResourceRequest.php b/AuditManager/src/V1/EnrollResourceRequest.php new file mode 100644 index 000000000000..ccbbdfd40469 --- /dev/null +++ b/AuditManager/src/V1/EnrollResourceRequest.php @@ -0,0 +1,166 @@ +google.cloud.auditmanager.v1.EnrollResourceRequest + */ +class EnrollResourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource to be enrolled to the audit manager. Scope format + * should be resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * organizations/{organization}/locations/{location} + * + * Generated from protobuf field string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $scope = ''; + /** + * Required. List of destination among which customer can choose to upload + * their reports during the audit process. While enrolling at a + * organization/folder level, customer can choose Cloud storage bucket in any + * project. If the audit is triggered at project level using the service agent + * at organization/folder level, all the destination options associated with + * respective organization/folder level service agent will be available to + * auditing projects. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.EnrollResourceRequest.EligibleDestination destinations = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $destinations; + + /** + * @param string $scope Required. The resource to be enrolled to the audit manager. Scope format + * should be resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * organizations/{organization}/locations/{location} + * @param \Google\Cloud\AuditManager\V1\EnrollResourceRequest\EligibleDestination[] $destinations Required. List of destination among which customer can choose to upload + * their reports during the audit process. While enrolling at a + * organization/folder level, customer can choose Cloud storage bucket in any + * project. If the audit is triggered at project level using the service agent + * at organization/folder level, all the destination options associated with + * respective organization/folder level service agent will be available to + * auditing projects. + * + * @return \Google\Cloud\AuditManager\V1\EnrollResourceRequest + * + * @experimental + */ + public static function build(string $scope, array $destinations): self + { + return (new self()) + ->setScope($scope) + ->setDestinations($destinations); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $scope + * Required. The resource to be enrolled to the audit manager. Scope format + * should be resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * organizations/{organization}/locations/{location} + * @type array<\Google\Cloud\AuditManager\V1\EnrollResourceRequest\EligibleDestination>|\Google\Protobuf\Internal\RepeatedField $destinations + * Required. List of destination among which customer can choose to upload + * their reports during the audit process. While enrolling at a + * organization/folder level, customer can choose Cloud storage bucket in any + * project. If the audit is triggered at project level using the service agent + * at organization/folder level, all the destination options associated with + * respective organization/folder level service agent will be available to + * auditing projects. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource to be enrolled to the audit manager. Scope format + * should be resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * organizations/{organization}/locations/{location} + * + * Generated from protobuf field string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getScope() + { + return $this->scope; + } + + /** + * Required. The resource to be enrolled to the audit manager. Scope format + * should be resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * organizations/{organization}/locations/{location} + * + * Generated from protobuf field string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setScope($var) + { + GPBUtil::checkString($var, True); + $this->scope = $var; + + return $this; + } + + /** + * Required. List of destination among which customer can choose to upload + * their reports during the audit process. While enrolling at a + * organization/folder level, customer can choose Cloud storage bucket in any + * project. If the audit is triggered at project level using the service agent + * at organization/folder level, all the destination options associated with + * respective organization/folder level service agent will be available to + * auditing projects. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.EnrollResourceRequest.EligibleDestination destinations = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinations() + { + return $this->destinations; + } + + /** + * Required. List of destination among which customer can choose to upload + * their reports during the audit process. While enrolling at a + * organization/folder level, customer can choose Cloud storage bucket in any + * project. If the audit is triggered at project level using the service agent + * at organization/folder level, all the destination options associated with + * respective organization/folder level service agent will be available to + * auditing projects. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.EnrollResourceRequest.EligibleDestination destinations = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\AuditManager\V1\EnrollResourceRequest\EligibleDestination>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AuditManager\V1\EnrollResourceRequest\EligibleDestination::class); + $this->destinations = $arr; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/EnrollResourceRequest/EligibleDestination.php b/AuditManager/src/V1/EnrollResourceRequest/EligibleDestination.php new file mode 100644 index 000000000000..59d45abb4286 --- /dev/null +++ b/AuditManager/src/V1/EnrollResourceRequest/EligibleDestination.php @@ -0,0 +1,79 @@ +google.cloud.auditmanager.v1.EnrollResourceRequest.EligibleDestination + */ +class EligibleDestination extends \Google\Protobuf\Internal\Message +{ + protected $eligible_destinations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $eligible_gcs_bucket + * The Cloud Storage bucket location where the audit report and evidences + * can be uploaded during the `GenerateAuditReport` API call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * The Cloud Storage bucket location where the audit report and evidences + * can be uploaded during the `GenerateAuditReport` API call. + * + * Generated from protobuf field string eligible_gcs_bucket = 3; + * @return string + */ + public function getEligibleGcsBucket() + { + return $this->readOneof(3); + } + + public function hasEligibleGcsBucket() + { + return $this->hasOneof(3); + } + + /** + * The Cloud Storage bucket location where the audit report and evidences + * can be uploaded during the `GenerateAuditReport` API call. + * + * Generated from protobuf field string eligible_gcs_bucket = 3; + * @param string $var + * @return $this + */ + public function setEligibleGcsBucket($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getEligibleDestinations() + { + return $this->whichOneof("eligible_destinations"); + } + +} + + diff --git a/AuditManager/src/V1/Enrollment.php b/AuditManager/src/V1/Enrollment.php new file mode 100644 index 000000000000..40f13d3b4aac --- /dev/null +++ b/AuditManager/src/V1/Enrollment.php @@ -0,0 +1,105 @@ +google.cloud.auditmanager.v1.Enrollment + */ +class Enrollment extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of this Enrollment, in the format of scope given in + * request. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. The locations where the generated reports can be uploaded. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.DestinationDetails destination_details = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $destination_details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of this Enrollment, in the format of scope given in + * request. + * @type array<\Google\Cloud\AuditManager\V1\DestinationDetails>|\Google\Protobuf\Internal\RepeatedField $destination_details + * Output only. The locations where the generated reports can be uploaded. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of this Enrollment, in the format of scope given in + * request. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of this Enrollment, in the format of scope given in + * request. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The locations where the generated reports can be uploaded. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.DestinationDetails destination_details = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinationDetails() + { + return $this->destination_details; + } + + /** + * Output only. The locations where the generated reports can be uploaded. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.DestinationDetails destination_details = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\AuditManager\V1\DestinationDetails>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinationDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AuditManager\V1\DestinationDetails::class); + $this->destination_details = $arr; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/GenerateAuditReportRequest.php b/AuditManager/src/V1/GenerateAuditReportRequest.php new file mode 100644 index 000000000000..dea4b2f5a7bd --- /dev/null +++ b/AuditManager/src/V1/GenerateAuditReportRequest.php @@ -0,0 +1,259 @@ +google.cloud.auditmanager.v1.GenerateAuditReportRequest + */ +class GenerateAuditReportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Scope for which the AuditScopeReport is required. Must be of + * format resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * + * Generated from protobuf field string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $scope = ''; + /** + * Required. Compliance Standard against which the Scope Report must be + * generated. Eg: FEDRAMP_MODERATE + * + * Generated from protobuf field string compliance_standard = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $compliance_standard = ''; + /** + * Required. The format in which the audit report should be created. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.GenerateAuditReportRequest.AuditReportFormat report_format = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $report_format = 0; + /** + * Required. Compliance framework against which the Report must be generated. + * + * Generated from protobuf field string compliance_framework = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $compliance_framework = ''; + protected $destination; + + /** + * @param string $scope Required. Scope for which the AuditScopeReport is required. Must be of + * format resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * @param string $gcsUri Destination Cloud storage bucket where report and evidence must be + * uploaded. The Cloud storage bucket provided here must be selected among + * the buckets entered during the enrollment process. + * @param string $complianceStandard Required. Compliance Standard against which the Scope Report must be + * generated. Eg: FEDRAMP_MODERATE + * @param int $reportFormat Required. The format in which the audit report should be created. + * For allowed values, use constants defined on {@see \Google\Cloud\AuditManager\V1\GenerateAuditReportRequest\AuditReportFormat} + * + * @return \Google\Cloud\AuditManager\V1\GenerateAuditReportRequest + * + * @experimental + */ + public static function build(string $scope, string $gcsUri, string $complianceStandard, int $reportFormat): self + { + return (new self()) + ->setScope($scope) + ->setGcsUri($gcsUri) + ->setComplianceStandard($complianceStandard) + ->setReportFormat($reportFormat); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gcs_uri + * Destination Cloud storage bucket where report and evidence must be + * uploaded. The Cloud storage bucket provided here must be selected among + * the buckets entered during the enrollment process. + * @type string $scope + * Required. Scope for which the AuditScopeReport is required. Must be of + * format resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * @type string $compliance_standard + * Required. Compliance Standard against which the Scope Report must be + * generated. Eg: FEDRAMP_MODERATE + * @type int $report_format + * Required. The format in which the audit report should be created. + * @type string $compliance_framework + * Required. Compliance framework against which the Report must be generated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Destination Cloud storage bucket where report and evidence must be + * uploaded. The Cloud storage bucket provided here must be selected among + * the buckets entered during the enrollment process. + * + * Generated from protobuf field string gcs_uri = 2; + * @return string + */ + public function getGcsUri() + { + return $this->readOneof(2); + } + + public function hasGcsUri() + { + return $this->hasOneof(2); + } + + /** + * Destination Cloud storage bucket where report and evidence must be + * uploaded. The Cloud storage bucket provided here must be selected among + * the buckets entered during the enrollment process. + * + * Generated from protobuf field string gcs_uri = 2; + * @param string $var + * @return $this + */ + public function setGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Required. Scope for which the AuditScopeReport is required. Must be of + * format resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * + * Generated from protobuf field string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getScope() + { + return $this->scope; + } + + /** + * Required. Scope for which the AuditScopeReport is required. Must be of + * format resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * + * Generated from protobuf field string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setScope($var) + { + GPBUtil::checkString($var, True); + $this->scope = $var; + + return $this; + } + + /** + * Required. Compliance Standard against which the Scope Report must be + * generated. Eg: FEDRAMP_MODERATE + * + * Generated from protobuf field string compliance_standard = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getComplianceStandard() + { + return $this->compliance_standard; + } + + /** + * Required. Compliance Standard against which the Scope Report must be + * generated. Eg: FEDRAMP_MODERATE + * + * Generated from protobuf field string compliance_standard = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setComplianceStandard($var) + { + GPBUtil::checkString($var, True); + $this->compliance_standard = $var; + + return $this; + } + + /** + * Required. The format in which the audit report should be created. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.GenerateAuditReportRequest.AuditReportFormat report_format = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getReportFormat() + { + return $this->report_format; + } + + /** + * Required. The format in which the audit report should be created. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.GenerateAuditReportRequest.AuditReportFormat report_format = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setReportFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AuditManager\V1\GenerateAuditReportRequest\AuditReportFormat::class); + $this->report_format = $var; + + return $this; + } + + /** + * Required. Compliance framework against which the Report must be generated. + * + * Generated from protobuf field string compliance_framework = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getComplianceFramework() + { + return $this->compliance_framework; + } + + /** + * Required. Compliance framework against which the Report must be generated. + * + * Generated from protobuf field string compliance_framework = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setComplianceFramework($var) + { + GPBUtil::checkString($var, True); + $this->compliance_framework = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/AuditManager/src/V1/GenerateAuditReportRequest/AuditReportFormat.php b/AuditManager/src/V1/GenerateAuditReportRequest/AuditReportFormat.php new file mode 100644 index 000000000000..7e2eedc29a08 --- /dev/null +++ b/AuditManager/src/V1/GenerateAuditReportRequest/AuditReportFormat.php @@ -0,0 +1,55 @@ +google.cloud.auditmanager.v1.GenerateAuditReportRequest.AuditReportFormat + */ +class AuditReportFormat +{ + /** + * Unspecified. Invalid state. + * + * Generated from protobuf enum AUDIT_REPORT_FORMAT_UNSPECIFIED = 0; + */ + const AUDIT_REPORT_FORMAT_UNSPECIFIED = 0; + /** + * Audit Report creation format is Open Document. + * + * Generated from protobuf enum AUDIT_REPORT_FORMAT_ODF = 1; + */ + const AUDIT_REPORT_FORMAT_ODF = 1; + + private static $valueToName = [ + self::AUDIT_REPORT_FORMAT_UNSPECIFIED => 'AUDIT_REPORT_FORMAT_UNSPECIFIED', + self::AUDIT_REPORT_FORMAT_ODF => 'AUDIT_REPORT_FORMAT_ODF', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AuditManager/src/V1/GenerateAuditScopeReportRequest.php b/AuditManager/src/V1/GenerateAuditScopeReportRequest.php new file mode 100644 index 000000000000..fe0ff8bcfef7 --- /dev/null +++ b/AuditManager/src/V1/GenerateAuditScopeReportRequest.php @@ -0,0 +1,211 @@ +google.cloud.auditmanager.v1.GenerateAuditScopeReportRequest + */ +class GenerateAuditScopeReportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Scope for which the AuditScopeReport is required. Must be of + * format resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * + * Generated from protobuf field string scope = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $scope = ''; + /** + * Required. Compliance Standard against which the Scope Report must be + * generated. Eg: FEDRAMP_MODERATE + * + * Generated from protobuf field string compliance_standard = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $compliance_standard = ''; + /** + * Required. The format in which the Scope report bytes should be returned. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.GenerateAuditScopeReportRequest.AuditScopeReportFormat report_format = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $report_format = 0; + /** + * Required. Compliance framework against which the Scope Report must be + * generated. + * + * Generated from protobuf field string compliance_framework = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $compliance_framework = ''; + + /** + * @param string $scope Required. Scope for which the AuditScopeReport is required. Must be of + * format resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * @param string $complianceStandard Required. Compliance Standard against which the Scope Report must be + * generated. Eg: FEDRAMP_MODERATE + * @param int $reportFormat Required. The format in which the Scope report bytes should be returned. + * For allowed values, use constants defined on {@see \Google\Cloud\AuditManager\V1\GenerateAuditScopeReportRequest\AuditScopeReportFormat} + * + * @return \Google\Cloud\AuditManager\V1\GenerateAuditScopeReportRequest + * + * @experimental + */ + public static function build(string $scope, string $complianceStandard, int $reportFormat): self + { + return (new self()) + ->setScope($scope) + ->setComplianceStandard($complianceStandard) + ->setReportFormat($reportFormat); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $scope + * Required. Scope for which the AuditScopeReport is required. Must be of + * format resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * @type string $compliance_standard + * Required. Compliance Standard against which the Scope Report must be + * generated. Eg: FEDRAMP_MODERATE + * @type int $report_format + * Required. The format in which the Scope report bytes should be returned. + * @type string $compliance_framework + * Required. Compliance framework against which the Scope Report must be + * generated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Required. Scope for which the AuditScopeReport is required. Must be of + * format resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * + * Generated from protobuf field string scope = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getScope() + { + return $this->scope; + } + + /** + * Required. Scope for which the AuditScopeReport is required. Must be of + * format resource_type/resource_identifier Eg: + * projects/{project}/locations/{location}, + * folders/{folder}/locations/{location} + * + * Generated from protobuf field string scope = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setScope($var) + { + GPBUtil::checkString($var, True); + $this->scope = $var; + + return $this; + } + + /** + * Required. Compliance Standard against which the Scope Report must be + * generated. Eg: FEDRAMP_MODERATE + * + * Generated from protobuf field string compliance_standard = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getComplianceStandard() + { + return $this->compliance_standard; + } + + /** + * Required. Compliance Standard against which the Scope Report must be + * generated. Eg: FEDRAMP_MODERATE + * + * Generated from protobuf field string compliance_standard = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setComplianceStandard($var) + { + GPBUtil::checkString($var, True); + $this->compliance_standard = $var; + + return $this; + } + + /** + * Required. The format in which the Scope report bytes should be returned. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.GenerateAuditScopeReportRequest.AuditScopeReportFormat report_format = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getReportFormat() + { + return $this->report_format; + } + + /** + * Required. The format in which the Scope report bytes should be returned. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.GenerateAuditScopeReportRequest.AuditScopeReportFormat report_format = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setReportFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AuditManager\V1\GenerateAuditScopeReportRequest\AuditScopeReportFormat::class); + $this->report_format = $var; + + return $this; + } + + /** + * Required. Compliance framework against which the Scope Report must be + * generated. + * + * Generated from protobuf field string compliance_framework = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getComplianceFramework() + { + return $this->compliance_framework; + } + + /** + * Required. Compliance framework against which the Scope Report must be + * generated. + * + * Generated from protobuf field string compliance_framework = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setComplianceFramework($var) + { + GPBUtil::checkString($var, True); + $this->compliance_framework = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/GenerateAuditScopeReportRequest/AuditScopeReportFormat.php b/AuditManager/src/V1/GenerateAuditScopeReportRequest/AuditScopeReportFormat.php new file mode 100644 index 000000000000..fcdb96f4c38e --- /dev/null +++ b/AuditManager/src/V1/GenerateAuditScopeReportRequest/AuditScopeReportFormat.php @@ -0,0 +1,55 @@ +google.cloud.auditmanager.v1.GenerateAuditScopeReportRequest.AuditScopeReportFormat + */ +class AuditScopeReportFormat +{ + /** + * Unspecified. Invalid format. + * + * Generated from protobuf enum AUDIT_SCOPE_REPORT_FORMAT_UNSPECIFIED = 0; + */ + const AUDIT_SCOPE_REPORT_FORMAT_UNSPECIFIED = 0; + /** + * Audit Scope Report creation format is Open Document. + * + * Generated from protobuf enum AUDIT_SCOPE_REPORT_FORMAT_ODF = 1; + */ + const AUDIT_SCOPE_REPORT_FORMAT_ODF = 1; + + private static $valueToName = [ + self::AUDIT_SCOPE_REPORT_FORMAT_UNSPECIFIED => 'AUDIT_SCOPE_REPORT_FORMAT_UNSPECIFIED', + self::AUDIT_SCOPE_REPORT_FORMAT_ODF => 'AUDIT_SCOPE_REPORT_FORMAT_ODF', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AuditManager/src/V1/GetAuditReportRequest.php b/AuditManager/src/V1/GetAuditReportRequest.php new file mode 100644 index 000000000000..f8fe2b3be2af --- /dev/null +++ b/AuditManager/src/V1/GetAuditReportRequest.php @@ -0,0 +1,91 @@ +google.cloud.auditmanager.v1.GetAuditReportRequest + */ +class GetAuditReportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Format + * projects/{project}/locations/{location}/auditReports/{audit_report}, + * folders/{folder}/locations/{location}/auditReports/{audit_report} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Format + * projects/{project}/locations/{location}/auditReports/{audit_report}, + * folders/{folder}/locations/{location}/auditReports/{audit_report} + * Please see {@see AuditManagerClient::auditReportName()} for help formatting this field. + * + * @return \Google\Cloud\AuditManager\V1\GetAuditReportRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Format + * projects/{project}/locations/{location}/auditReports/{audit_report}, + * folders/{folder}/locations/{location}/auditReports/{audit_report} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Required. Format + * projects/{project}/locations/{location}/auditReports/{audit_report}, + * folders/{folder}/locations/{location}/auditReports/{audit_report} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Format + * projects/{project}/locations/{location}/auditReports/{audit_report}, + * folders/{folder}/locations/{location}/auditReports/{audit_report} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/GetResourceEnrollmentStatusRequest.php b/AuditManager/src/V1/GetResourceEnrollmentStatusRequest.php new file mode 100644 index 000000000000..ccf270941f4d --- /dev/null +++ b/AuditManager/src/V1/GetResourceEnrollmentStatusRequest.php @@ -0,0 +1,96 @@ +google.cloud.auditmanager.v1.GetResourceEnrollmentStatusRequest + */ +class GetResourceEnrollmentStatusRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Format + * folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, + * projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, + * organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Format + * folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, + * projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, + * organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status} + * Please see {@see AuditManagerClient::resourceEnrollmentStatusName()} for help formatting this field. + * + * @return \Google\Cloud\AuditManager\V1\GetResourceEnrollmentStatusRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Format + * folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, + * projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, + * organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Required. Format + * folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, + * projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, + * organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Format + * folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, + * projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, + * organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/ListAuditReportsRequest.php b/AuditManager/src/V1/ListAuditReportsRequest.php new file mode 100644 index 000000000000..8f1ade60482d --- /dev/null +++ b/AuditManager/src/V1/ListAuditReportsRequest.php @@ -0,0 +1,153 @@ +google.cloud.auditmanager.v1.ListAuditReportsRequest + */ +class ListAuditReportsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent scope for which to list the reports. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of resources to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent scope for which to list the reports. Please see + * {@see AuditManagerClient::folderLocationName()} for help formatting this field. + * + * @return \Google\Cloud\AuditManager\V1\ListAuditReportsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent scope for which to list the reports. + * @type int $page_size + * Optional. The maximum number of resources to return. + * @type string $page_token + * Optional. The next_page_token value returned from a previous List request, + * if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent scope for which to list the reports. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent scope for which to list the reports. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of resources to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of resources to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/ListAuditReportsResponse.php b/AuditManager/src/V1/ListAuditReportsResponse.php new file mode 100644 index 000000000000..b34bd51a69de --- /dev/null +++ b/AuditManager/src/V1/ListAuditReportsResponse.php @@ -0,0 +1,101 @@ +google.cloud.auditmanager.v1.ListAuditReportsResponse + */ +class ListAuditReportsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The audit reports. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.AuditReport audit_reports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $audit_reports; + /** + * Output only. The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\AuditManager\V1\AuditReport>|\Google\Protobuf\Internal\RepeatedField $audit_reports + * Output only. The audit reports. + * @type string $next_page_token + * Output only. The token to retrieve the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The audit reports. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.AuditReport audit_reports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAuditReports() + { + return $this->audit_reports; + } + + /** + * Output only. The audit reports. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.AuditReport audit_reports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\AuditManager\V1\AuditReport>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAuditReports($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AuditManager\V1\AuditReport::class); + $this->audit_reports = $arr; + + return $this; + } + + /** + * Output only. The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/ListControlsRequest.php b/AuditManager/src/V1/ListControlsRequest.php new file mode 100644 index 000000000000..eb9b8e37a7b2 --- /dev/null +++ b/AuditManager/src/V1/ListControlsRequest.php @@ -0,0 +1,163 @@ +google.cloud.auditmanager.v1.ListControlsRequest + */ +class ListControlsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Format + * projects/{project}/locations/{location}/standards/{standard}, + * folders/{folder}/locations/{location}/standards/{standard} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of resources to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. Format + * projects/{project}/locations/{location}/standards/{standard}, + * folders/{folder}/locations/{location}/standards/{standard} + * Please see {@see AuditManagerClient::standardName()} for help formatting this field. + * + * @return \Google\Cloud\AuditManager\V1\ListControlsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Format + * projects/{project}/locations/{location}/standards/{standard}, + * folders/{folder}/locations/{location}/standards/{standard} + * @type int $page_size + * Optional. The maximum number of resources to return. + * @type string $page_token + * Optional. The next_page_token value returned from a previous List request, + * if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Required. Format + * projects/{project}/locations/{location}/standards/{standard}, + * folders/{folder}/locations/{location}/standards/{standard} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Format + * projects/{project}/locations/{location}/standards/{standard}, + * folders/{folder}/locations/{location}/standards/{standard} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of resources to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of resources to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/ListControlsResponse.php b/AuditManager/src/V1/ListControlsResponse.php new file mode 100644 index 000000000000..411b54dd886e --- /dev/null +++ b/AuditManager/src/V1/ListControlsResponse.php @@ -0,0 +1,101 @@ +google.cloud.auditmanager.v1.ListControlsResponse + */ +class ListControlsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The controls for the compliance standard. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.Control controls = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $controls; + /** + * Output only. The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\AuditManager\V1\Control>|\Google\Protobuf\Internal\RepeatedField $controls + * Output only. The controls for the compliance standard. + * @type string $next_page_token + * Output only. The token to retrieve the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The controls for the compliance standard. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.Control controls = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getControls() + { + return $this->controls; + } + + /** + * Output only. The controls for the compliance standard. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.Control controls = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\AuditManager\V1\Control>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setControls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AuditManager\V1\Control::class); + $this->controls = $arr; + + return $this; + } + + /** + * Output only. The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/ListResourceEnrollmentStatusesRequest.php b/AuditManager/src/V1/ListResourceEnrollmentStatusesRequest.php new file mode 100644 index 000000000000..fc57a61755ae --- /dev/null +++ b/AuditManager/src/V1/ListResourceEnrollmentStatusesRequest.php @@ -0,0 +1,159 @@ +google.cloud.auditmanager.v1.ListResourceEnrollmentStatusesRequest + */ +class ListResourceEnrollmentStatusesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent scope for which the list of resources with enrollments + * are required. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of resources to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent scope for which the list of resources with enrollments + * are required. Please see + * {@see AuditManagerClient::enrollmentStatusScopeName()} for help formatting this field. + * + * @return \Google\Cloud\AuditManager\V1\ListResourceEnrollmentStatusesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent scope for which the list of resources with enrollments + * are required. + * @type int $page_size + * Optional. The maximum number of resources to return. + * @type string $page_token + * Optional. The next_page_token value returned from a previous List request, + * if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent scope for which the list of resources with enrollments + * are required. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent scope for which the list of resources with enrollments + * are required. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of resources to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of resources to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/ListResourceEnrollmentStatusesResponse.php b/AuditManager/src/V1/ListResourceEnrollmentStatusesResponse.php new file mode 100644 index 000000000000..1c75e14711ee --- /dev/null +++ b/AuditManager/src/V1/ListResourceEnrollmentStatusesResponse.php @@ -0,0 +1,101 @@ +google.cloud.auditmanager.v1.ListResourceEnrollmentStatusesResponse + */ +class ListResourceEnrollmentStatusesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The resources with their enrollment status. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.ResourceEnrollmentStatus resource_enrollment_statuses = 1; + */ + private $resource_enrollment_statuses; + /** + * Output only. The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\AuditManager\V1\ResourceEnrollmentStatus>|\Google\Protobuf\Internal\RepeatedField $resource_enrollment_statuses + * The resources with their enrollment status. + * @type string $next_page_token + * Output only. The token to retrieve the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * The resources with their enrollment status. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.ResourceEnrollmentStatus resource_enrollment_statuses = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResourceEnrollmentStatuses() + { + return $this->resource_enrollment_statuses; + } + + /** + * The resources with their enrollment status. + * + * Generated from protobuf field repeated .google.cloud.auditmanager.v1.ResourceEnrollmentStatus resource_enrollment_statuses = 1; + * @param array<\Google\Cloud\AuditManager\V1\ResourceEnrollmentStatus>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResourceEnrollmentStatuses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AuditManager\V1\ResourceEnrollmentStatus::class); + $this->resource_enrollment_statuses = $arr; + + return $this; + } + + /** + * Output only. The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/OperationMetadata.php b/AuditManager/src/V1/OperationMetadata.php new file mode 100644 index 000000000000..6baf524d9a02 --- /dev/null +++ b/AuditManager/src/V1/OperationMetadata.php @@ -0,0 +1,307 @@ +google.cloud.auditmanager.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have been cancelled successfully + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the operation finished running. + * @type string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have been cancelled successfully + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have been cancelled successfully + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have been cancelled successfully + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/OperationState.php b/AuditManager/src/V1/OperationState.php new file mode 100644 index 000000000000..8abd675373a4 --- /dev/null +++ b/AuditManager/src/V1/OperationState.php @@ -0,0 +1,105 @@ +google.cloud.auditmanager.v1.OperationState + */ +class OperationState +{ + /** + * Unspecified. Invalid state. + * + * Generated from protobuf enum OPERATION_STATE_UNSPECIFIED = 0; + */ + const OPERATION_STATE_UNSPECIFIED = 0; + /** + * Audit report generation process has not started. + * + * Generated from protobuf enum OPERATION_STATE_NOT_STARTED = 10; + */ + const OPERATION_STATE_NOT_STARTED = 10; + /** + * Audit Manager is currently evaluating the workloads against specific + * standard. + * + * Generated from protobuf enum OPERATION_STATE_EVALUATION_IN_PROGRESS = 20; + */ + const OPERATION_STATE_EVALUATION_IN_PROGRESS = 20; + /** + * Audit Manager has completed Evaluation for the workload. + * + * Generated from protobuf enum OPERATION_STATE_EVALUATION_DONE = 21; + */ + const OPERATION_STATE_EVALUATION_DONE = 21; + /** + * Audit Manager is creating audit report from the evaluated data. + * + * Generated from protobuf enum OPERATION_STATE_EVIDENCE_REPORT_GENERATION_IN_PROGRESS = 30; + */ + const OPERATION_STATE_EVIDENCE_REPORT_GENERATION_IN_PROGRESS = 30; + /** + * Audit Manager has completed generation of the audit report. + * + * Generated from protobuf enum OPERATION_STATE_EVIDENCE_REPORT_GENERATION_DONE = 31; + */ + const OPERATION_STATE_EVIDENCE_REPORT_GENERATION_DONE = 31; + /** + * Audit Manager is uploading the audit report and evidences to the customer + * provided destination. + * + * Generated from protobuf enum OPERATION_STATE_EVIDENCE_UPLOAD_IN_PROGRESS = 40; + */ + const OPERATION_STATE_EVIDENCE_UPLOAD_IN_PROGRESS = 40; + /** + * Audit report generation process is completed. + * + * Generated from protobuf enum OPERATION_STATE_DONE = 50; + */ + const OPERATION_STATE_DONE = 50; + /** + * Audit report generation process has failed. + * + * Generated from protobuf enum OPERATION_STATE_FAILED = 60; + */ + const OPERATION_STATE_FAILED = 60; + + private static $valueToName = [ + self::OPERATION_STATE_UNSPECIFIED => 'OPERATION_STATE_UNSPECIFIED', + self::OPERATION_STATE_NOT_STARTED => 'OPERATION_STATE_NOT_STARTED', + self::OPERATION_STATE_EVALUATION_IN_PROGRESS => 'OPERATION_STATE_EVALUATION_IN_PROGRESS', + self::OPERATION_STATE_EVALUATION_DONE => 'OPERATION_STATE_EVALUATION_DONE', + self::OPERATION_STATE_EVIDENCE_REPORT_GENERATION_IN_PROGRESS => 'OPERATION_STATE_EVIDENCE_REPORT_GENERATION_IN_PROGRESS', + self::OPERATION_STATE_EVIDENCE_REPORT_GENERATION_DONE => 'OPERATION_STATE_EVIDENCE_REPORT_GENERATION_DONE', + self::OPERATION_STATE_EVIDENCE_UPLOAD_IN_PROGRESS => 'OPERATION_STATE_EVIDENCE_UPLOAD_IN_PROGRESS', + self::OPERATION_STATE_DONE => 'OPERATION_STATE_DONE', + self::OPERATION_STATE_FAILED => 'OPERATION_STATE_FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/AuditManager/src/V1/ReportGenerationProgress.php b/AuditManager/src/V1/ReportGenerationProgress.php new file mode 100644 index 000000000000..8aab4c6e7dfe --- /dev/null +++ b/AuditManager/src/V1/ReportGenerationProgress.php @@ -0,0 +1,321 @@ +google.cloud.auditmanager.v1.ReportGenerationProgress + */ +class ReportGenerationProgress extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The current state of execution for report generation. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.OperationState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. States the reason of failure during the audit report + * generation process. This field is set only if the state attribute is + * OPERATION_STATE_FAILED. + * + * Generated from protobuf field string failure_reason = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $failure_reason = ''; + /** + * Shows the progress of the CESS service evaluation process. The progress is + * defined in terms of percentage complete and is being fetched from the CESS + * service. + * + * Generated from protobuf field double evaluation_percent_complete = 20; + */ + protected $evaluation_percent_complete = 0.0; + /** + * Shows the report generation progress of the CESS Result Processor Service. + * The // progress is defined in terms of percentage complete and is being + * fetched from the CESS service. If report_generation_in_progress is non zero + * then evaluation_percent_complete will be 100%. + * + * Generated from protobuf field double report_generation_percent_complete = 30; + */ + protected $report_generation_percent_complete = 0.0; + /** + * Shows the report uploading progress of the CESS Result Processor Service. + * The progress is defined in terms of percentage complete and is being + * fetched from the CESS service. If report_uploading_in_progress is non zero + * then evaluation_percent_complete and report_generation_percent_complete + * will be 100%. + * + * Generated from protobuf field double report_uploading_percent_complete = 40; + */ + protected $report_uploading_percent_complete = 0.0; + /** + * Output only. The Cloud Storage bucket where the audit report will be + * uploaded once the evaluation process is completed. + * + * Generated from protobuf field string destination_gcs_bucket = 50 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $destination_gcs_bucket = ''; + /** + * Output only. The name of the audit report. + * + * Generated from protobuf field string audit_report = 51 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $audit_report = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * Output only. The current state of execution for report generation. + * @type string $failure_reason + * Output only. States the reason of failure during the audit report + * generation process. This field is set only if the state attribute is + * OPERATION_STATE_FAILED. + * @type float $evaluation_percent_complete + * Shows the progress of the CESS service evaluation process. The progress is + * defined in terms of percentage complete and is being fetched from the CESS + * service. + * @type float $report_generation_percent_complete + * Shows the report generation progress of the CESS Result Processor Service. + * The // progress is defined in terms of percentage complete and is being + * fetched from the CESS service. If report_generation_in_progress is non zero + * then evaluation_percent_complete will be 100%. + * @type float $report_uploading_percent_complete + * Shows the report uploading progress of the CESS Result Processor Service. + * The progress is defined in terms of percentage complete and is being + * fetched from the CESS service. If report_uploading_in_progress is non zero + * then evaluation_percent_complete and report_generation_percent_complete + * will be 100%. + * @type string $destination_gcs_bucket + * Output only. The Cloud Storage bucket where the audit report will be + * uploaded once the evaluation process is completed. + * @type string $audit_report + * Output only. The name of the audit report. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The current state of execution for report generation. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.OperationState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of execution for report generation. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.OperationState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AuditManager\V1\OperationState::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. States the reason of failure during the audit report + * generation process. This field is set only if the state attribute is + * OPERATION_STATE_FAILED. + * + * Generated from protobuf field string failure_reason = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFailureReason() + { + return $this->failure_reason; + } + + /** + * Output only. States the reason of failure during the audit report + * generation process. This field is set only if the state attribute is + * OPERATION_STATE_FAILED. + * + * Generated from protobuf field string failure_reason = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFailureReason($var) + { + GPBUtil::checkString($var, True); + $this->failure_reason = $var; + + return $this; + } + + /** + * Shows the progress of the CESS service evaluation process. The progress is + * defined in terms of percentage complete and is being fetched from the CESS + * service. + * + * Generated from protobuf field double evaluation_percent_complete = 20; + * @return float + */ + public function getEvaluationPercentComplete() + { + return $this->evaluation_percent_complete; + } + + /** + * Shows the progress of the CESS service evaluation process. The progress is + * defined in terms of percentage complete and is being fetched from the CESS + * service. + * + * Generated from protobuf field double evaluation_percent_complete = 20; + * @param float $var + * @return $this + */ + public function setEvaluationPercentComplete($var) + { + GPBUtil::checkDouble($var); + $this->evaluation_percent_complete = $var; + + return $this; + } + + /** + * Shows the report generation progress of the CESS Result Processor Service. + * The // progress is defined in terms of percentage complete and is being + * fetched from the CESS service. If report_generation_in_progress is non zero + * then evaluation_percent_complete will be 100%. + * + * Generated from protobuf field double report_generation_percent_complete = 30; + * @return float + */ + public function getReportGenerationPercentComplete() + { + return $this->report_generation_percent_complete; + } + + /** + * Shows the report generation progress of the CESS Result Processor Service. + * The // progress is defined in terms of percentage complete and is being + * fetched from the CESS service. If report_generation_in_progress is non zero + * then evaluation_percent_complete will be 100%. + * + * Generated from protobuf field double report_generation_percent_complete = 30; + * @param float $var + * @return $this + */ + public function setReportGenerationPercentComplete($var) + { + GPBUtil::checkDouble($var); + $this->report_generation_percent_complete = $var; + + return $this; + } + + /** + * Shows the report uploading progress of the CESS Result Processor Service. + * The progress is defined in terms of percentage complete and is being + * fetched from the CESS service. If report_uploading_in_progress is non zero + * then evaluation_percent_complete and report_generation_percent_complete + * will be 100%. + * + * Generated from protobuf field double report_uploading_percent_complete = 40; + * @return float + */ + public function getReportUploadingPercentComplete() + { + return $this->report_uploading_percent_complete; + } + + /** + * Shows the report uploading progress of the CESS Result Processor Service. + * The progress is defined in terms of percentage complete and is being + * fetched from the CESS service. If report_uploading_in_progress is non zero + * then evaluation_percent_complete and report_generation_percent_complete + * will be 100%. + * + * Generated from protobuf field double report_uploading_percent_complete = 40; + * @param float $var + * @return $this + */ + public function setReportUploadingPercentComplete($var) + { + GPBUtil::checkDouble($var); + $this->report_uploading_percent_complete = $var; + + return $this; + } + + /** + * Output only. The Cloud Storage bucket where the audit report will be + * uploaded once the evaluation process is completed. + * + * Generated from protobuf field string destination_gcs_bucket = 50 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDestinationGcsBucket() + { + return $this->destination_gcs_bucket; + } + + /** + * Output only. The Cloud Storage bucket where the audit report will be + * uploaded once the evaluation process is completed. + * + * Generated from protobuf field string destination_gcs_bucket = 50 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDestinationGcsBucket($var) + { + GPBUtil::checkString($var, True); + $this->destination_gcs_bucket = $var; + + return $this; + } + + /** + * Output only. The name of the audit report. + * + * Generated from protobuf field string audit_report = 51 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getAuditReport() + { + return $this->audit_report; + } + + /** + * Output only. The name of the audit report. + * + * Generated from protobuf field string audit_report = 51 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAuditReport($var) + { + GPBUtil::checkString($var, True); + $this->audit_report = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/ReportSummary.php b/AuditManager/src/V1/ReportSummary.php new file mode 100644 index 000000000000..f1521d5ed1d6 --- /dev/null +++ b/AuditManager/src/V1/ReportSummary.php @@ -0,0 +1,203 @@ +google.cloud.auditmanager.v1.ReportSummary + */ +class ReportSummary extends \Google\Protobuf\Internal\Message +{ + /** + * Total number of checks. + * + * Generated from protobuf field int32 total_count = 1; + */ + protected $total_count = 0; + /** + * Number of compliant checks. + * + * Generated from protobuf field int32 compliant_count = 2; + */ + protected $compliant_count = 0; + /** + * Number of checks with violations. + * + * Generated from protobuf field int32 violation_count = 3; + */ + protected $violation_count = 0; + /** + * Number of checks with "manual review needed" status. + * + * Generated from protobuf field int32 manual_review_needed_count = 4; + */ + protected $manual_review_needed_count = 0; + /** + * Number of checks that could not be performed due to errors. + * + * Generated from protobuf field int32 error_count = 5; + */ + protected $error_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $total_count + * Total number of checks. + * @type int $compliant_count + * Number of compliant checks. + * @type int $violation_count + * Number of checks with violations. + * @type int $manual_review_needed_count + * Number of checks with "manual review needed" status. + * @type int $error_count + * Number of checks that could not be performed due to errors. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Total number of checks. + * + * Generated from protobuf field int32 total_count = 1; + * @return int + */ + public function getTotalCount() + { + return $this->total_count; + } + + /** + * Total number of checks. + * + * Generated from protobuf field int32 total_count = 1; + * @param int $var + * @return $this + */ + public function setTotalCount($var) + { + GPBUtil::checkInt32($var); + $this->total_count = $var; + + return $this; + } + + /** + * Number of compliant checks. + * + * Generated from protobuf field int32 compliant_count = 2; + * @return int + */ + public function getCompliantCount() + { + return $this->compliant_count; + } + + /** + * Number of compliant checks. + * + * Generated from protobuf field int32 compliant_count = 2; + * @param int $var + * @return $this + */ + public function setCompliantCount($var) + { + GPBUtil::checkInt32($var); + $this->compliant_count = $var; + + return $this; + } + + /** + * Number of checks with violations. + * + * Generated from protobuf field int32 violation_count = 3; + * @return int + */ + public function getViolationCount() + { + return $this->violation_count; + } + + /** + * Number of checks with violations. + * + * Generated from protobuf field int32 violation_count = 3; + * @param int $var + * @return $this + */ + public function setViolationCount($var) + { + GPBUtil::checkInt32($var); + $this->violation_count = $var; + + return $this; + } + + /** + * Number of checks with "manual review needed" status. + * + * Generated from protobuf field int32 manual_review_needed_count = 4; + * @return int + */ + public function getManualReviewNeededCount() + { + return $this->manual_review_needed_count; + } + + /** + * Number of checks with "manual review needed" status. + * + * Generated from protobuf field int32 manual_review_needed_count = 4; + * @param int $var + * @return $this + */ + public function setManualReviewNeededCount($var) + { + GPBUtil::checkInt32($var); + $this->manual_review_needed_count = $var; + + return $this; + } + + /** + * Number of checks that could not be performed due to errors. + * + * Generated from protobuf field int32 error_count = 5; + * @return int + */ + public function getErrorCount() + { + return $this->error_count; + } + + /** + * Number of checks that could not be performed due to errors. + * + * Generated from protobuf field int32 error_count = 5; + * @param int $var + * @return $this + */ + public function setErrorCount($var) + { + GPBUtil::checkInt32($var); + $this->error_count = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/ResourceEnrollmentStatus.php b/AuditManager/src/V1/ResourceEnrollmentStatus.php new file mode 100644 index 000000000000..0df173c817c8 --- /dev/null +++ b/AuditManager/src/V1/ResourceEnrollmentStatus.php @@ -0,0 +1,224 @@ +google.cloud.auditmanager.v1.ResourceEnrollmentStatus + */ +class ResourceEnrollmentStatus extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of this resource. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. Enrollment which contains enrolled destination details for a + * resource + * + * Generated from protobuf field .google.cloud.auditmanager.v1.Enrollment enrollment = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $enrollment = null; + /** + * Output only. Is resource enrolled. + * + * Generated from protobuf field bool enrolled = 3 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @deprecated + */ + protected $enrolled = false; + /** + * Output only. Display name of the project/folder/organization. + * + * Generated from protobuf field string display_name = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $display_name = ''; + /** + * Output only. Enrollment state of the resource. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ResourceEnrollmentStatus.ResourceEnrollmentState enrollment_state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $enrollment_state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of this resource. + * @type \Google\Cloud\AuditManager\V1\Enrollment $enrollment + * Output only. Enrollment which contains enrolled destination details for a + * resource + * @type bool $enrolled + * Output only. Is resource enrolled. + * @type string $display_name + * Output only. Display name of the project/folder/organization. + * @type int $enrollment_state + * Output only. Enrollment state of the resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Auditmanager\V1\Auditmanager::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of this resource. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of this resource. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Enrollment which contains enrolled destination details for a + * resource + * + * Generated from protobuf field .google.cloud.auditmanager.v1.Enrollment enrollment = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AuditManager\V1\Enrollment|null + */ + public function getEnrollment() + { + return $this->enrollment; + } + + public function hasEnrollment() + { + return isset($this->enrollment); + } + + public function clearEnrollment() + { + unset($this->enrollment); + } + + /** + * Output only. Enrollment which contains enrolled destination details for a + * resource + * + * Generated from protobuf field .google.cloud.auditmanager.v1.Enrollment enrollment = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AuditManager\V1\Enrollment $var + * @return $this + */ + public function setEnrollment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AuditManager\V1\Enrollment::class); + $this->enrollment = $var; + + return $this; + } + + /** + * Output only. Is resource enrolled. + * + * Generated from protobuf field bool enrolled = 3 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + * @deprecated + */ + public function getEnrolled() + { + if ($this->enrolled !== false) { + @trigger_error('enrolled is deprecated.', E_USER_DEPRECATED); + } + return $this->enrolled; + } + + /** + * Output only. Is resource enrolled. + * + * Generated from protobuf field bool enrolled = 3 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + * @deprecated + */ + public function setEnrolled($var) + { + @trigger_error('enrolled is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkBool($var); + $this->enrolled = $var; + + return $this; + } + + /** + * Output only. Display name of the project/folder/organization. + * + * Generated from protobuf field string display_name = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Output only. Display name of the project/folder/organization. + * + * Generated from protobuf field string display_name = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. Enrollment state of the resource. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ResourceEnrollmentStatus.ResourceEnrollmentState enrollment_state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getEnrollmentState() + { + return $this->enrollment_state; + } + + /** + * Output only. Enrollment state of the resource. + * + * Generated from protobuf field .google.cloud.auditmanager.v1.ResourceEnrollmentStatus.ResourceEnrollmentState enrollment_state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setEnrollmentState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AuditManager\V1\ResourceEnrollmentStatus\ResourceEnrollmentState::class); + $this->enrollment_state = $var; + + return $this; + } + +} + diff --git a/AuditManager/src/V1/ResourceEnrollmentStatus/ResourceEnrollmentState.php b/AuditManager/src/V1/ResourceEnrollmentStatus/ResourceEnrollmentState.php new file mode 100644 index 000000000000..567d202c29c4 --- /dev/null +++ b/AuditManager/src/V1/ResourceEnrollmentStatus/ResourceEnrollmentState.php @@ -0,0 +1,69 @@ +google.cloud.auditmanager.v1.ResourceEnrollmentStatus.ResourceEnrollmentState + */ +class ResourceEnrollmentState +{ + /** + * Unspecified. Invalid state. + * + * Generated from protobuf enum RESOURCE_ENROLLMENT_STATE_UNSPECIFIED = 0; + */ + const RESOURCE_ENROLLMENT_STATE_UNSPECIFIED = 0; + /** + * Not enrolled. + * + * Generated from protobuf enum NOT_ENROLLED = 1; + */ + const NOT_ENROLLED = 1; + /** + * Resource is not enrolled but the parent is enrolled. + * + * Generated from protobuf enum INHERITED = 2; + */ + const INHERITED = 2; + /** + * Enrolled. + * + * Generated from protobuf enum ENROLLED = 3; + */ + const ENROLLED = 3; + + private static $valueToName = [ + self::RESOURCE_ENROLLMENT_STATE_UNSPECIFIED => 'RESOURCE_ENROLLMENT_STATE_UNSPECIFIED', + self::NOT_ENROLLED => 'NOT_ENROLLED', + self::INHERITED => 'INHERITED', + self::ENROLLED => 'ENROLLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AuditManager/src/V1/gapic_metadata.json b/AuditManager/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..cefc1825f767 --- /dev/null +++ b/AuditManager/src/V1/gapic_metadata.json @@ -0,0 +1,68 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.auditmanager.v1", + "libraryPackage": "Google\\Cloud\\AuditManager\\V1", + "services": { + "AuditManager": { + "clients": { + "grpc": { + "libraryClient": "AuditManagerGapicClient", + "rpcs": { + "EnrollResource": { + "methods": [ + "enrollResource" + ] + }, + "GenerateAuditReport": { + "methods": [ + "generateAuditReport" + ] + }, + "GenerateAuditScopeReport": { + "methods": [ + "generateAuditScopeReport" + ] + }, + "GetAuditReport": { + "methods": [ + "getAuditReport" + ] + }, + "GetResourceEnrollmentStatus": { + "methods": [ + "getResourceEnrollmentStatus" + ] + }, + "ListAuditReports": { + "methods": [ + "listAuditReports" + ] + }, + "ListControls": { + "methods": [ + "listControls" + ] + }, + "ListResourceEnrollmentStatuses": { + "methods": [ + "listResourceEnrollmentStatuses" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/AuditManager/src/V1/resources/audit_manager_client_config.json b/AuditManager/src/V1/resources/audit_manager_client_config.json new file mode 100644 index 000000000000..621862801f8f --- /dev/null +++ b/AuditManager/src/V1/resources/audit_manager_client_config.json @@ -0,0 +1,94 @@ +{ + "interfaces": { + "google.cloud.auditmanager.v1.AuditManager": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "no_retry_1_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "EnrollResource": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GenerateAuditReport": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GenerateAuditScopeReport": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetAuditReport": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetResourceEnrollmentStatus": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListAuditReports": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListControls": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListResourceEnrollmentStatuses": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/AuditManager/src/V1/resources/audit_manager_descriptor_config.php b/AuditManager/src/V1/resources/audit_manager_descriptor_config.php new file mode 100644 index 000000000000..f769ad7d7c3f --- /dev/null +++ b/AuditManager/src/V1/resources/audit_manager_descriptor_config.php @@ -0,0 +1,206 @@ + [ + 'google.cloud.auditmanager.v1.AuditManager' => [ + 'GenerateAuditReport' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AuditManager\V1\AuditReport', + 'metadataReturnType' => '\Google\Cloud\AuditManager\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'scope', + 'fieldAccessors' => [ + 'getScope', + ], + ], + ], + ], + 'EnrollResource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\AuditManager\V1\Enrollment', + 'headerParams' => [ + [ + 'keyName' => 'scope', + 'fieldAccessors' => [ + 'getScope', + ], + ], + ], + ], + 'GenerateAuditScopeReport' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\AuditManager\V1\AuditScopeReport', + 'headerParams' => [ + [ + 'keyName' => 'scope', + 'fieldAccessors' => [ + 'getScope', + ], + ], + ], + ], + 'GetAuditReport' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\AuditManager\V1\AuditReport', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetResourceEnrollmentStatus' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\AuditManager\V1\ResourceEnrollmentStatus', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListAuditReports' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAuditReports', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\AuditManager\V1\ListAuditReportsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListControls' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getControls', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\AuditManager\V1\ListControlsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListResourceEnrollmentStatuses' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getResourceEnrollmentStatuses', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\AuditManager\V1\ListResourceEnrollmentStatusesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'auditReport' => 'projects/{project}/locations/{location}/auditReports/{audit_report}', + 'enrollmentStatusScope' => 'folders/{folder}/locations/{location}', + 'folderLocation' => 'folders/{folder}/locations/{location}', + 'folderLocationAuditReport' => 'folders/{folder}/locations/{location}/auditReports/{audit_report}', + 'folderLocationResourceEnrollmentStatus' => 'folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}', + 'folderLocationStandard' => 'folders/{folder}/locations/{location}/standards/{standard}', + 'location' => 'projects/{project}/locations/{location}', + 'organizationLocation' => 'organizations/{organization}/locations/{location}', + 'organizationLocationResourceEnrollmentStatus' => 'organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}', + 'organizationLocationStandard' => 'organizations/{organization}/locations/{location}/standards/{standard}', + 'projectLocationAuditReport' => 'projects/{project}/locations/{location}/auditReports/{audit_report}', + 'projectLocationResourceEnrollmentStatus' => 'projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}', + 'projectLocationStandard' => 'projects/{project}/locations/{location}/standards/{standard}', + 'resourceEnrollmentStatus' => 'folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}', + 'standard' => 'projects/{project}/locations/{location}/standards/{standard}', + ], + ], + ], +]; diff --git a/AuditManager/src/V1/resources/audit_manager_rest_client_config.php b/AuditManager/src/V1/resources/audit_manager_rest_client_config.php new file mode 100644 index 000000000000..d8a89311d794 --- /dev/null +++ b/AuditManager/src/V1/resources/audit_manager_rest_client_config.php @@ -0,0 +1,284 @@ + [ + 'google.cloud.auditmanager.v1.AuditManager' => [ + 'EnrollResource' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{scope=folders/*/locations/*}:enrollResource', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{scope=projects/*/locations/*}:enrollResource', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{scope=organizations/*/locations/*}:enrollResource', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'scope' => [ + 'getters' => [ + 'getScope', + ], + ], + ], + ], + 'GenerateAuditReport' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{scope=folders/*/locations/*}/auditReports:generate', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{scope=projects/*/locations/*}/auditReports:generate', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'scope' => [ + 'getters' => [ + 'getScope', + ], + ], + ], + ], + 'GenerateAuditScopeReport' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{scope=folders/*/locations/*}/auditScopeReports:generate', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{scope=projects/*/locations/*}/auditScopeReports:generate', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'scope' => [ + 'getters' => [ + 'getScope', + ], + ], + ], + ], + 'GetAuditReport' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=folders/*/locations/*/auditReports/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/auditReports/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetResourceEnrollmentStatus' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/resourceEnrollmentStatuses/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=folders/*/locations/*/resourceEnrollmentStatuses/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/resourceEnrollmentStatuses/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListAuditReports' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=organizations/*/locations/*}/auditReports', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=folders/*/locations/*}/auditReports', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/auditReports', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListControls' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=organizations/*/locations/*/standards/*}/controls', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=folders/*/locations/*/standards/*}/controls', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/standards/*}/controls', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListResourceEnrollmentStatuses' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=organizations/*/locations/*}/resourceEnrollmentStatuses', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=folders/*/locations/*}/resourceEnrollmentStatuses', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*}/operations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/AuditManager/tests/Unit/V1/Client/AuditManagerClientTest.php b/AuditManager/tests/Unit/V1/Client/AuditManagerClientTest.php new file mode 100644 index 000000000000..bc37b9dd5141 --- /dev/null +++ b/AuditManager/tests/Unit/V1/Client/AuditManagerClientTest.php @@ -0,0 +1,922 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return AuditManagerClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AuditManagerClient($options); + } + + /** @test */ + public function enrollResourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Enrollment(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $scope = 'scope109264468'; + $destinations = []; + $request = (new EnrollResourceRequest())->setScope($scope)->setDestinations($destinations); + $response = $gapicClient->enrollResource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.auditmanager.v1.AuditManager/EnrollResource', $actualFuncCall); + $actualValue = $actualRequestObject->getScope(); + $this->assertProtobufEquals($scope, $actualValue); + $actualValue = $actualRequestObject->getDestinations(); + $this->assertProtobufEquals($destinations, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function enrollResourceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $scope = 'scope109264468'; + $destinations = []; + $request = (new EnrollResourceRequest())->setScope($scope)->setDestinations($destinations); + try { + $gapicClient->enrollResource($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateAuditReportTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/generateAuditReportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $operationId = 'operationId-274116877'; + $complianceStandard2 = 'complianceStandard2-1079015980'; + $scope2 = 'scope21923941639'; + $complianceFramework2 = 'complianceFramework2-1333971955'; + $scopeId = 'scopeId-487349530'; + $expectedResponse = new AuditReport(); + $expectedResponse->setName($name); + $expectedResponse->setOperationId($operationId); + $expectedResponse->setComplianceStandard($complianceStandard2); + $expectedResponse->setScope($scope2); + $expectedResponse->setComplianceFramework($complianceFramework2); + $expectedResponse->setScopeId($scopeId); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/generateAuditReportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $scope = 'scope109264468'; + $complianceStandard = 'complianceStandard1339657825'; + $reportFormat = AuditReportFormat::AUDIT_REPORT_FORMAT_UNSPECIFIED; + $complianceFramework = 'complianceFramework1384085210'; + $request = (new GenerateAuditReportRequest()) + ->setScope($scope) + ->setComplianceStandard($complianceStandard) + ->setReportFormat($reportFormat) + ->setComplianceFramework($complianceFramework); + $response = $gapicClient->generateAuditReport($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.auditmanager.v1.AuditManager/GenerateAuditReport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getScope(); + $this->assertProtobufEquals($scope, $actualValue); + $actualValue = $actualApiRequestObject->getComplianceStandard(); + $this->assertProtobufEquals($complianceStandard, $actualValue); + $actualValue = $actualApiRequestObject->getReportFormat(); + $this->assertProtobufEquals($reportFormat, $actualValue); + $actualValue = $actualApiRequestObject->getComplianceFramework(); + $this->assertProtobufEquals($complianceFramework, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/generateAuditReportTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function generateAuditReportExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/generateAuditReportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $operationsTransport->addResponse(null, $status); + // Mock request + $scope = 'scope109264468'; + $complianceStandard = 'complianceStandard1339657825'; + $reportFormat = AuditReportFormat::AUDIT_REPORT_FORMAT_UNSPECIFIED; + $complianceFramework = 'complianceFramework1384085210'; + $request = (new GenerateAuditReportRequest()) + ->setScope($scope) + ->setComplianceStandard($complianceStandard) + ->setReportFormat($reportFormat) + ->setComplianceFramework($complianceFramework); + $response = $gapicClient->generateAuditReport($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/generateAuditReportTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function generateAuditScopeReportTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $scopeReportContents = '-38'; + $name = 'name3373707'; + $expectedResponse = new AuditScopeReport(); + $expectedResponse->setScopeReportContents($scopeReportContents); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $scope = 'scope109264468'; + $complianceStandard = 'complianceStandard1339657825'; + $reportFormat = AuditScopeReportFormat::AUDIT_SCOPE_REPORT_FORMAT_UNSPECIFIED; + $complianceFramework = 'complianceFramework1384085210'; + $request = (new GenerateAuditScopeReportRequest()) + ->setScope($scope) + ->setComplianceStandard($complianceStandard) + ->setReportFormat($reportFormat) + ->setComplianceFramework($complianceFramework); + $response = $gapicClient->generateAuditScopeReport($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.auditmanager.v1.AuditManager/GenerateAuditScopeReport', $actualFuncCall); + $actualValue = $actualRequestObject->getScope(); + $this->assertProtobufEquals($scope, $actualValue); + $actualValue = $actualRequestObject->getComplianceStandard(); + $this->assertProtobufEquals($complianceStandard, $actualValue); + $actualValue = $actualRequestObject->getReportFormat(); + $this->assertProtobufEquals($reportFormat, $actualValue); + $actualValue = $actualRequestObject->getComplianceFramework(); + $this->assertProtobufEquals($complianceFramework, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateAuditScopeReportExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $scope = 'scope109264468'; + $complianceStandard = 'complianceStandard1339657825'; + $reportFormat = AuditScopeReportFormat::AUDIT_SCOPE_REPORT_FORMAT_UNSPECIFIED; + $complianceFramework = 'complianceFramework1384085210'; + $request = (new GenerateAuditScopeReportRequest()) + ->setScope($scope) + ->setComplianceStandard($complianceStandard) + ->setReportFormat($reportFormat) + ->setComplianceFramework($complianceFramework); + try { + $gapicClient->generateAuditScopeReport($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAuditReportTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $operationId = 'operationId-274116877'; + $complianceStandard = 'complianceStandard1339657825'; + $scope = 'scope109264468'; + $complianceFramework = 'complianceFramework1384085210'; + $scopeId = 'scopeId-487349530'; + $expectedResponse = new AuditReport(); + $expectedResponse->setName($name2); + $expectedResponse->setOperationId($operationId); + $expectedResponse->setComplianceStandard($complianceStandard); + $expectedResponse->setScope($scope); + $expectedResponse->setComplianceFramework($complianceFramework); + $expectedResponse->setScopeId($scopeId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->auditReportName('[PROJECT]', '[LOCATION]', '[AUDIT_REPORT]'); + $request = (new GetAuditReportRequest())->setName($formattedName); + $response = $gapicClient->getAuditReport($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.auditmanager.v1.AuditManager/GetAuditReport', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAuditReportExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->auditReportName('[PROJECT]', '[LOCATION]', '[AUDIT_REPORT]'); + $request = (new GetAuditReportRequest())->setName($formattedName); + try { + $gapicClient->getAuditReport($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getResourceEnrollmentStatusTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $enrolled = false; + $displayName = 'displayName1615086568'; + $expectedResponse = new ResourceEnrollmentStatus(); + $expectedResponse->setName($name2); + $expectedResponse->setEnrolled($enrolled); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->resourceEnrollmentStatusName( + '[FOLDER]', + '[LOCATION]', + '[RESOURCE_ENROLLMENT_STATUS]' + ); + $request = (new GetResourceEnrollmentStatusRequest())->setName($formattedName); + $response = $gapicClient->getResourceEnrollmentStatus($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.auditmanager.v1.AuditManager/GetResourceEnrollmentStatus', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getResourceEnrollmentStatusExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->resourceEnrollmentStatusName( + '[FOLDER]', + '[LOCATION]', + '[RESOURCE_ENROLLMENT_STATUS]' + ); + $request = (new GetResourceEnrollmentStatusRequest())->setName($formattedName); + try { + $gapicClient->getResourceEnrollmentStatus($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAuditReportsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $auditReportsElement = new AuditReport(); + $auditReports = [$auditReportsElement]; + $expectedResponse = new ListAuditReportsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAuditReports($auditReports); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->folderLocationName('[FOLDER]', '[LOCATION]'); + $request = (new ListAuditReportsRequest())->setParent($formattedParent); + $response = $gapicClient->listAuditReports($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAuditReports()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.auditmanager.v1.AuditManager/ListAuditReports', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAuditReportsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->folderLocationName('[FOLDER]', '[LOCATION]'); + $request = (new ListAuditReportsRequest())->setParent($formattedParent); + try { + $gapicClient->listAuditReports($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listControlsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $controlsElement = new Control(); + $controls = [$controlsElement]; + $expectedResponse = new ListControlsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setControls($controls); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->standardName('[PROJECT]', '[LOCATION]', '[STANDARD]'); + $request = (new ListControlsRequest())->setParent($formattedParent); + $response = $gapicClient->listControls($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getControls()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.auditmanager.v1.AuditManager/ListControls', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listControlsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->standardName('[PROJECT]', '[LOCATION]', '[STANDARD]'); + $request = (new ListControlsRequest())->setParent($formattedParent); + try { + $gapicClient->listControls($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listResourceEnrollmentStatusesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $resourceEnrollmentStatusesElement = new ResourceEnrollmentStatus(); + $resourceEnrollmentStatuses = [$resourceEnrollmentStatusesElement]; + $expectedResponse = new ListResourceEnrollmentStatusesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setResourceEnrollmentStatuses($resourceEnrollmentStatuses); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->enrollmentStatusScopeName('[FOLDER]', '[LOCATION]'); + $request = (new ListResourceEnrollmentStatusesRequest())->setParent($formattedParent); + $response = $gapicClient->listResourceEnrollmentStatuses($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getResourceEnrollmentStatuses()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.auditmanager.v1.AuditManager/ListResourceEnrollmentStatuses', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listResourceEnrollmentStatusesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->enrollmentStatusScopeName('[FOLDER]', '[LOCATION]'); + $request = (new ListResourceEnrollmentStatusesRequest())->setParent($formattedParent); + try { + $gapicClient->listResourceEnrollmentStatuses($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [$locationsElement]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function enrollResourceAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Enrollment(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $scope = 'scope109264468'; + $destinations = []; + $request = (new EnrollResourceRequest())->setScope($scope)->setDestinations($destinations); + $response = $gapicClient->enrollResourceAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.auditmanager.v1.AuditManager/EnrollResource', $actualFuncCall); + $actualValue = $actualRequestObject->getScope(); + $this->assertProtobufEquals($scope, $actualValue); + $actualValue = $actualRequestObject->getDestinations(); + $this->assertProtobufEquals($destinations, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/composer.json b/composer.json index 8a326522dc78..c765742b9a54 100644 --- a/composer.json +++ b/composer.json @@ -103,6 +103,7 @@ "google/cloud-artifact-registry": "1.6.0", "google/cloud-asset": "2.3.2", "google/cloud-assured-workloads": "1.1.2", + "google/cloud-auditmanager": "0.0.0", "google/cloud-automl": "2.1.2", "google/cloud-backupdr": "0.12.0", "google/cloud-bare-metal-solution": "1.1.2", @@ -336,6 +337,7 @@ "GPBMetadata\\Google\\Cloud\\Asset\\": "Asset/metadata", "GPBMetadata\\Google\\Cloud\\Assuredworkloads\\": "AssuredWorkloads/metadata", "GPBMetadata\\Google\\Cloud\\Audit\\": "CloudCommonProtos/metadata/Audit", + "GPBMetadata\\Google\\Cloud\\Auditmanager\\": "AuditManager/metadata", "GPBMetadata\\Google\\Cloud\\Automl\\": "AutoMl/metadata", "GPBMetadata\\Google\\Cloud\\Backupdr\\": "BackupDr/metadata", "GPBMetadata\\Google\\Cloud\\Baremetalsolution\\": "BareMetalSolution/metadata", @@ -570,6 +572,7 @@ "Google\\Cloud\\ArtifactRegistry\\": "ArtifactRegistry/src", "Google\\Cloud\\Asset\\": "Asset/src", "Google\\Cloud\\AssuredWorkloads\\": "AssuredWorkloads/src", + "Google\\Cloud\\AuditManager\\": "AuditManager/src", "Google\\Cloud\\AutoMl\\": "AutoMl/src", "Google\\Cloud\\BackupDR\\": "BackupDr/src", "Google\\Cloud\\BareMetalSolution\\": "BareMetalSolution/src",