Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [Channel] Add CloudChannelReportsService #5121

Merged
merged 28 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2ac4eda
feat: Add API definitions for Cloud Channel Repricing APIs
gcf-owl-bot[bot] Apr 27, 2022
bbf6e66
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Apr 27, 2022
3882a3c
chore(bazel): update gapic-generator-php to v1.4.8
gcf-owl-bot[bot] Jun 16, 2022
9e170dc
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jun 16, 2022
cef7546
chore(bazel): update protobuf to v3.21.3
gcf-owl-bot[bot] Jul 25, 2022
b77d7e3
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 25, 2022
f042aec
chore(bazel): update gapic-generator-php to v1.5.0
gcf-owl-bot[bot] Jul 27, 2022
442dc03
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 27, 2022
7bfcb98
feat: Add CloudChannelReportsService to CloudChannel API
gcf-owl-bot[bot] Oct 17, 2022
a9db85e
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Oct 17, 2022
2e6a0a2
feat: add deal_code field to message Offer
gcf-owl-bot[bot] Nov 9, 2022
b45be10
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Nov 9, 2022
af08f70
chore(bazel): update gapic-generator-php to v1.6.0
gcf-owl-bot[bot] Nov 9, 2022
ce8df00
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Nov 9, 2022
67da179
chore(bazel): update gapic-generator-php to v1.6.1
gcf-owl-bot[bot] Nov 17, 2022
286f046
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Nov 17, 2022
dd6c08e
chore(bazel): update gapic-generator-php to v1.6.2
gcf-owl-bot[bot] Dec 6, 2022
8b46719
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Dec 6, 2022
ef548ab
feat: Add support for granular repricing configurations via SkuGroups…
gcf-owl-bot[bot] Dec 9, 2022
8fe2a27
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Dec 9, 2022
4bd370a
feat: Add location methods
gcf-owl-bot[bot] Jan 3, 2023
fad143a
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jan 3, 2023
f17219f
chore(bazel): update gapic-generator-php to v1.6.4
gcf-owl-bot[bot] Jan 5, 2023
b36ddf0
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jan 5, 2023
0d21d49
merge main
Jan 12, 2023
649885b
merge main
Jan 13, 2023
ebd032f
add samples
Jan 13, 2023
8570db0
Merge branch 'main' into owl-bot-copy-Channel
dwsupplee Jan 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Channel/metadata/V1/ChannelPartnerLinks.php
Binary file not shown.
Binary file modified Channel/metadata/V1/Common.php
Binary file not shown.
5 changes: 2 additions & 3 deletions Channel/metadata/V1/Customers.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Channel/metadata/V1/Entitlements.php
Binary file not shown.
Binary file modified Channel/metadata/V1/Offers.php
Binary file not shown.
Binary file modified Channel/metadata/V1/Operations.php
Binary file not shown.
Binary file modified Channel/metadata/V1/Products.php
Binary file not shown.
Binary file added Channel/metadata/V1/ReportsService.php
Binary file not shown.
Binary file added Channel/metadata/V1/Repricing.php
Binary file not shown.
Binary file modified Channel/metadata/V1/Service.php
Binary file not shown.
Binary file modified Channel/metadata/V1/SubscriberEvent.php
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?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_CloudChannelReportsService_FetchReportResults_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Channel\V1\CloudChannelReportsServiceClient;
use Google\Cloud\Channel\V1\Row;

/**
* Retrieves data generated by
* [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob].
*
* @param string $formattedReportJob The report job created by
* [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob].
* Report_job uses the format:
* accounts/{account_id}/reportJobs/{report_job_id}
* Please see {@see CloudChannelReportsServiceClient::reportJobName()} for help formatting this field.
*/
function fetch_report_results_sample(string $formattedReportJob): void
{
// Create a client.
$cloudChannelReportsServiceClient = new CloudChannelReportsServiceClient();

// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $cloudChannelReportsServiceClient->fetchReportResults($formattedReportJob);

/** @var Row $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
{
$formattedReportJob = CloudChannelReportsServiceClient::reportJobName('[ACCOUNT]', '[REPORT_JOB]');

fetch_report_results_sample($formattedReportJob);
}
// [END cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?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_CloudChannelReportsService_ListReports_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Channel\V1\CloudChannelReportsServiceClient;
use Google\Cloud\Channel\V1\Report;

/**
* Lists the reports that RunReportJob can run. These reports include an ID,
* a description, and the list of columns that will be in the result.
*
* @param string $parent The resource name of the partner account to list available
* reports for. Parent uses the format: accounts/{account_id}
*/
function list_reports_sample(string $parent): void
{
// Create a client.
$cloudChannelReportsServiceClient = new CloudChannelReportsServiceClient();

// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $cloudChannelReportsServiceClient->listReports($parent);

/** @var Report $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_reports_sample($parent);
}
// [END cloudchannel_v1_generated_CloudChannelReportsService_ListReports_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?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_CloudChannelReportsService_RunReportJob_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Channel\V1\CloudChannelReportsServiceClient;
use Google\Cloud\Channel\V1\RunReportJobResponse;
use Google\Rpc\Status;

/**
* Begins generation of data for a given report. The report
* identifier is a UID (for example, `613bf59q`).
*
* Possible error codes:
*
* * PERMISSION_DENIED: The user doesn't have access to this report.
* * INVALID_ARGUMENT: Required request parameters are missing
* or invalid.
* * NOT_FOUND: The report identifier was not found.
* * INTERNAL: Any non-user error related to a technical issue
* in the backend. Contact Cloud Channel support.
* * UNKNOWN: Any non-user error related to a technical issue
* in the backend. Contact Cloud Channel support.
*
* Return value:
* The ID of a long-running operation.
*
* To get the results of the operation, call the GetOperation method of
* CloudChannelOperationsService. The Operation metadata contains an
* instance of [OperationMetadata][google.cloud.channel.v1.OperationMetadata].
*
* To get the results of report generation, call
* [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]
* with the
* [RunReportJobResponse.report_job][google.cloud.channel.v1.RunReportJobResponse.report_job].
*
* @param string $formattedName The report's resource name. Specifies the account and report used
* to generate report data. The report_id identifier is a UID (for example,
* `613bf59q`).
* Name uses the format:
* accounts/{account_id}/reports/{report_id}
* Please see {@see CloudChannelReportsServiceClient::reportName()} for help formatting this field.
*/
function run_report_job_sample(string $formattedName): void
{
// Create a client.
$cloudChannelReportsServiceClient = new CloudChannelReportsServiceClient();

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $cloudChannelReportsServiceClient->runReportJob($formattedName);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var RunReportJobResponse $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
{
$formattedName = CloudChannelReportsServiceClient::reportName('[ACCOUNT]', '[REPORT]');

run_report_job_sample($formattedName);
}
// [END cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?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_ActivateEntitlement_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Channel\V1\CloudChannelServiceClient;
use Google\Cloud\Channel\V1\Entitlement;
use Google\Rpc\Status;

/**
* Activates a previously suspended entitlement. Entitlements suspended for
* pending ToS acceptance can't be activated using this method.
*
* An entitlement activation is a long-running operation and it updates
* the state of the customer entitlement.
*
* Possible error codes:
*
* * PERMISSION_DENIED: The reseller account making the request is different
* from the reseller account in the API request.
* * INVALID_ARGUMENT: Required request parameters are missing or invalid.
* * NOT_FOUND: Entitlement resource not found.
* * SUSPENSION_NOT_RESELLER_INITIATED: Can only activate reseller-initiated
* suspensions and entitlements that have accepted the TOS.
* * NOT_SUSPENDED: Can only activate suspended entitlements not in an ACTIVE
* state.
* * INTERNAL: Any non-user error related to a technical issue in the
* backend. Contact Cloud Channel support.
* * UNKNOWN: Any non-user error related to a technical issue in the backend.
* Contact Cloud Channel support.
*
* Return value:
* The ID of a long-running operation.
*
* To get the results of the operation, call the GetOperation method of
* CloudChannelOperationsService. The Operation metadata will contain an
* instance of [OperationMetadata][google.cloud.channel.v1.OperationMetadata].
*
* @param string $name The resource name of the entitlement to activate.
* Name uses the format:
* accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
*/
function activate_entitlement_sample(string $name): void
{
// Create a client.
$cloudChannelServiceClient = new CloudChannelServiceClient();

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $cloudChannelServiceClient->activateEntitlement($name);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var Entitlement $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
{
$name = '[NAME]';

activate_entitlement_sample($name);
}
// [END cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_sync]
Loading