-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add field `psc_allowed_projects` to message `.google.cloud.securesourcemanager.v1.Instance` docs: A comment for field `instance` in message `.google.cloud.securesourcemanager.v1.Repository` is changed PiperOrigin-RevId: 688170540 Source-Link: googleapis/googleapis@b6a9d80 Source-Link: googleapis/googleapis-gen@d9406c5 Copy-Tag: eyJwIjoiU2VjdXJlU291cmNlTWFuYWdlci8uT3dsQm90LnlhbWwiLCJoIjoiZDk0MDZjNWU4NDBkMWU4Mjg5MjMyY2EwODk4MjdiNzFjNzYwMWMwMCJ9
- Loading branch information
1 parent
12921fc
commit be3a11c
Showing
22 changed files
with
2,912 additions
and
31 deletions.
There are no files selected for viewing
Binary file not shown.
91 changes: 91 additions & 0 deletions
91
SecureSourceManager/samples/V1/SecureSourceManagerClient/create_branch_rule.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
/* | ||
* 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 | ||
* | ||
* https://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. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START securesourcemanager_v1_generated_SecureSourceManager_CreateBranchRule_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\OperationResponse; | ||
use Google\Cloud\SecureSourceManager\V1\BranchRule; | ||
use Google\Cloud\SecureSourceManager\V1\Client\SecureSourceManagerClient; | ||
use Google\Cloud\SecureSourceManager\V1\CreateBranchRuleRequest; | ||
use Google\Rpc\Status; | ||
|
||
/** | ||
* CreateBranchRule creates a branch rule in a given repository. | ||
* | ||
* @param string $formattedParent Please see {@see SecureSourceManagerClient::repositoryName()} for help formatting this field. | ||
* @param string $branchRuleId | ||
*/ | ||
function create_branch_rule_sample(string $formattedParent, string $branchRuleId): void | ||
{ | ||
// Create a client. | ||
$secureSourceManagerClient = new SecureSourceManagerClient(); | ||
|
||
// Prepare the request message. | ||
$branchRule = new BranchRule(); | ||
$request = (new CreateBranchRuleRequest()) | ||
->setParent($formattedParent) | ||
->setBranchRule($branchRule) | ||
->setBranchRuleId($branchRuleId); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var OperationResponse $response */ | ||
$response = $secureSourceManagerClient->createBranchRule($request); | ||
$response->pollUntilComplete(); | ||
|
||
if ($response->operationSucceeded()) { | ||
/** @var BranchRule $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 | ||
{ | ||
$formattedParent = SecureSourceManagerClient::repositoryName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[REPOSITORY]' | ||
); | ||
$branchRuleId = '[BRANCH_RULE_ID]'; | ||
|
||
create_branch_rule_sample($formattedParent, $branchRuleId); | ||
} | ||
// [END securesourcemanager_v1_generated_SecureSourceManager_CreateBranchRule_sync] |
84 changes: 84 additions & 0 deletions
84
SecureSourceManager/samples/V1/SecureSourceManagerClient/delete_branch_rule.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
/* | ||
* 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 | ||
* | ||
* https://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. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START securesourcemanager_v1_generated_SecureSourceManager_DeleteBranchRule_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\OperationResponse; | ||
use Google\Cloud\SecureSourceManager\V1\Client\SecureSourceManagerClient; | ||
use Google\Cloud\SecureSourceManager\V1\DeleteBranchRuleRequest; | ||
use Google\Rpc\Status; | ||
|
||
/** | ||
* DeleteBranchRule deletes a branch rule. | ||
* | ||
* @param string $formattedName Please see {@see SecureSourceManagerClient::branchRuleName()} for help formatting this field. | ||
*/ | ||
function delete_branch_rule_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$secureSourceManagerClient = new SecureSourceManagerClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new DeleteBranchRuleRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var OperationResponse $response */ | ||
$response = $secureSourceManagerClient->deleteBranchRule($request); | ||
$response->pollUntilComplete(); | ||
|
||
if ($response->operationSucceeded()) { | ||
printf('Operation completed successfully.' . PHP_EOL); | ||
} 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 | ||
{ | ||
$formattedName = SecureSourceManagerClient::branchRuleName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[REPOSITORY]', | ||
'[BRANCH_RULE]' | ||
); | ||
|
||
delete_branch_rule_sample($formattedName); | ||
} | ||
// [END securesourcemanager_v1_generated_SecureSourceManager_DeleteBranchRule_sync] |
78 changes: 78 additions & 0 deletions
78
SecureSourceManager/samples/V1/SecureSourceManagerClient/get_branch_rule.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/* | ||
* 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 | ||
* | ||
* https://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. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START securesourcemanager_v1_generated_SecureSourceManager_GetBranchRule_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\SecureSourceManager\V1\BranchRule; | ||
use Google\Cloud\SecureSourceManager\V1\Client\SecureSourceManagerClient; | ||
use Google\Cloud\SecureSourceManager\V1\GetBranchRuleRequest; | ||
|
||
/** | ||
* GetBranchRule gets a branch rule. | ||
* | ||
* @param string $formattedName Name of the repository to retrieve. | ||
* The format is | ||
* `projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branch_rule}`. Please see | ||
* {@see SecureSourceManagerClient::branchRuleName()} for help formatting this field. | ||
*/ | ||
function get_branch_rule_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$secureSourceManagerClient = new SecureSourceManagerClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new GetBranchRuleRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var BranchRule $response */ | ||
$response = $secureSourceManagerClient->getBranchRule($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 = SecureSourceManagerClient::branchRuleName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[REPOSITORY]', | ||
'[BRANCH_RULE]' | ||
); | ||
|
||
get_branch_rule_sample($formattedName); | ||
} | ||
// [END securesourcemanager_v1_generated_SecureSourceManager_GetBranchRule_sync] |
79 changes: 79 additions & 0 deletions
79
SecureSourceManager/samples/V1/SecureSourceManagerClient/list_branch_rules.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
/* | ||
* 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 | ||
* | ||
* https://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. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START securesourcemanager_v1_generated_SecureSourceManager_ListBranchRules_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\PagedListResponse; | ||
use Google\Cloud\SecureSourceManager\V1\BranchRule; | ||
use Google\Cloud\SecureSourceManager\V1\Client\SecureSourceManagerClient; | ||
use Google\Cloud\SecureSourceManager\V1\ListBranchRulesRequest; | ||
|
||
/** | ||
* ListBranchRules lists branch rules in a given repository. | ||
* | ||
* @param string $formattedParent Please see {@see SecureSourceManagerClient::repositoryName()} for help formatting this field. | ||
*/ | ||
function list_branch_rules_sample(string $formattedParent): void | ||
{ | ||
// Create a client. | ||
$secureSourceManagerClient = new SecureSourceManagerClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new ListBranchRulesRequest()) | ||
->setParent($formattedParent); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var PagedListResponse $response */ | ||
$response = $secureSourceManagerClient->listBranchRules($request); | ||
|
||
/** @var BranchRule $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 = SecureSourceManagerClient::repositoryName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[REPOSITORY]' | ||
); | ||
|
||
list_branch_rules_sample($formattedParent); | ||
} | ||
// [END securesourcemanager_v1_generated_SecureSourceManager_ListBranchRules_sync] |
Oops, something went wrong.