-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for ListSkuGroups and ListSkuGroupBillableSkus APIs…
… in Cloud Channel APIs (#6365) PiperOrigin-RevId: 540624759 Source-Link: googleapis/googleapis@7f2c9d1 Source-Link: googleapis/googleapis-gen@2ed2d95 Copy-Tag: eyJwIjoiQ2hhbm5lbC8uT3dsQm90LnlhbWwiLCJoIjoiMmVkMmQ5NWI2MjU1ZDBhMzNlY2Q5NjFhZjZjOWNhOGIwMmNkOGUwMyJ9
- Loading branch information
1 parent
9f2c061
commit 1d38e43
Showing
17 changed files
with
1,749 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
90 changes: 90 additions & 0 deletions
90
Channel/samples/V1/CloudChannelServiceClient/list_sku_group_billable_skus.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,90 @@ | ||
<?php | ||
/* | ||
* Copyright 2023 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 cloudchannel_v1_generated_CloudChannelService_ListSkuGroupBillableSkus_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\PagedListResponse; | ||
use Google\Cloud\Channel\V1\BillableSku; | ||
use Google\Cloud\Channel\V1\CloudChannelServiceClient; | ||
|
||
/** | ||
* Lists the Billable SKUs in a given SKU group. | ||
* | ||
* Possible error codes: | ||
* PERMISSION_DENIED: If the account making the request and the account | ||
* being queried for are different, or the account doesn't exist. | ||
* INVALID_ARGUMENT: Missing or invalid required parameters in the | ||
* request. | ||
* INTERNAL: Any non-user error related to technical issue in the | ||
* backend. In this case, contact cloud channel support. | ||
* | ||
* Return Value: | ||
* If successful, the [BillableSku][google.cloud.channel.v1.BillableSku] | ||
* resources. The data for each resource is displayed in the ascending order | ||
* of: | ||
* | ||
* * [BillableSku.service_display_name][google.cloud.channel.v1.BillableSku.service_display_name] | ||
* * [BillableSku.sku_display_name][google.cloud.channel.v1.BillableSku.sku_display_name] | ||
* | ||
* If unsuccessful, returns an error. | ||
* | ||
* @param string $formattedParent Resource name of the SKU group. | ||
* Format: accounts/{account}/skuGroups/{sku_group}. Please see | ||
* {@see CloudChannelServiceClient::skuGroupName()} for help formatting this field. | ||
*/ | ||
function list_sku_group_billable_skus_sample(string $formattedParent): void | ||
{ | ||
// Create a client. | ||
$cloudChannelServiceClient = new CloudChannelServiceClient(); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var PagedListResponse $response */ | ||
$response = $cloudChannelServiceClient->listSkuGroupBillableSkus($formattedParent); | ||
|
||
/** @var BillableSku $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 = CloudChannelServiceClient::skuGroupName('[ACCOUNT]', '[SKU_GROUP]'); | ||
|
||
list_sku_group_billable_skus_sample($formattedParent); | ||
} | ||
// [END cloudchannel_v1_generated_CloudChannelService_ListSkuGroupBillableSkus_sync] |
89 changes: 89 additions & 0 deletions
89
Channel/samples/V1/CloudChannelServiceClient/list_sku_groups.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,89 @@ | ||
<?php | ||
/* | ||
* Copyright 2023 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 cloudchannel_v1_generated_CloudChannelService_ListSkuGroups_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\PagedListResponse; | ||
use Google\Cloud\Channel\V1\CloudChannelServiceClient; | ||
use Google\Cloud\Channel\V1\SkuGroup; | ||
|
||
/** | ||
* Lists the Rebilling supported SKU groups the account is authorized to | ||
* sell. | ||
* Reference: https://cloud.google.com/skus/sku-groups | ||
* | ||
* Possible Error Codes: | ||
* | ||
* * PERMISSION_DENIED: If the account making the request and the account | ||
* being queried are different, or the account doesn't exist. | ||
* * INTERNAL: Any non-user error related to technical issues in the | ||
* backend. In this case, contact Cloud Channel support. | ||
* | ||
* Return Value: | ||
* If successful, the [SkuGroup][google.cloud.channel.v1.SkuGroup] resources. | ||
* The data for each resource is displayed in the alphabetical order of SKU | ||
* group display name. | ||
* The data for each resource is displayed in the ascending order of | ||
* [SkuGroup.display_name][google.cloud.channel.v1.SkuGroup.display_name] | ||
* | ||
* If unsuccessful, returns an error. | ||
* | ||
* @param string $parent The resource name of the account from which to list SKU groups. | ||
* Parent uses the format: accounts/{account}. | ||
*/ | ||
function list_sku_groups_sample(string $parent): void | ||
{ | ||
// Create a client. | ||
$cloudChannelServiceClient = new CloudChannelServiceClient(); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var PagedListResponse $response */ | ||
$response = $cloudChannelServiceClient->listSkuGroups($parent); | ||
|
||
/** @var SkuGroup $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 | ||
{ | ||
$parent = '[PARENT]'; | ||
|
||
list_sku_groups_sample($parent); | ||
} | ||
// [END cloudchannel_v1_generated_CloudChannelService_ListSkuGroups_sync] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.