Skip to content

Commit

Permalink
Merge branch 'main' into integration-test-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Sep 27, 2024
2 parents 07cc2e1 + 524f5a8 commit 3c1abdb
Show file tree
Hide file tree
Showing 587 changed files with 67,759 additions and 2,050 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/system-tests-spanner-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

services:
emulator:
image: gcr.io/cloud-spanner-emulator/emulator:1.5.23
image: gcr.io/cloud-spanner-emulator/emulator:1.5.24
ports:
- 9010:9010
- 9020:9020
Expand Down
18 changes: 17 additions & 1 deletion .repo-metadata-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
"library_type": "GAPIC_AUTO",
"api_shortname": "accesscontextmanager"
},
"AdsMarketingPlatformAdmin": {
"language": "php",
"distribution_name": "google/ads-marketingplatform-admin",
"release_level": "preview",
"client_documentation": "https://cloud.google.com/php/docs/reference/ads-marketingplatform-admin/latest",
"library_type": "GAPIC_AUTO",
"api_shortname": "marketingplatformadmin"
},
"AdvisoryNotifications": {
"language": "php",
"distribution_name": "google/cloud-advisorynotifications",
Expand Down Expand Up @@ -966,6 +974,14 @@
"library_type": "GAPIC_AUTO",
"api_shortname": "cloudoptimization"
},
"OracleDatabase": {
"language": "php",
"distribution_name": "google/cloud-oracledatabase",
"release_level": "preview",
"client_documentation": "https://cloud.google.com/php/docs/reference/cloud-oracledatabase/latest",
"library_type": "GAPIC_AUTO",
"api_shortname": "oracledatabase"
},
"OrchestrationAirflow": {
"language": "php",
"distribution_name": "google/cloud-orchestration-airflow",
Expand Down Expand Up @@ -1286,7 +1302,7 @@
"library_type": "GAPIC_AUTO",
"api_shortname": "merchantapi"
},
"ShoppingMerchantDatasources": {
"ShoppingMerchantDataSources": {
"language": "php",
"distribution_name": "google/shopping-merchant-datasources",
"release_level": "preview",
Expand Down
4 changes: 4 additions & 0 deletions AdsMarketingPlatformAdmin/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deep-copy-regex:
- source: /google/marketingplatform/admin/(v1alpha)/.*-php/(.*)
dest: /owl-bot-staging/AdsMarketingPlatformAdmin/$1/$2
api-name: AdsMarketingPlatformAdmin
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $ git clone [email protected]:googleapis/google-cloud-php.git
```

* Move your changes into the correct location in that library. Library code
belongs in `ShoppingMerchantDatasources/src`, and tests in `ShoppingMerchantDatasources/tests`.
belongs in `AdsMarketingPlatformAdmin/src`, and tests in `AdsMarketingPlatformAdmin/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).
Expand Down
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions AdsMarketingPlatformAdmin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Google Ads Marketing Platform Admin for PHP

> Idiomatic PHP client for [Google Ads Marketing Platform Admin](https://developers.google.com/analytics/devguides/config/gmp/v1).
[![Latest Stable Version](https://poser.pugx.org/google/ads-marketingplatform-admin/v/stable)](https://packagist.org/packages/google/ads-marketingplatform-admin) [![Packagist](https://img.shields.io/packagist/dm/google/ads-marketingplatform-admin.svg)](https://packagist.org/packages/google/ads-marketingplatform-admin)

* [API documentation](https://cloud.google.com/php/docs/reference/ads-marketingplatform-admin/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/ads-marketingplatform-admin
```

> 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

See the [samples directory](https://github.com/googleapis/php-ads-marketingplatform-admin/tree/main/samples) for a canonical list of samples.

### 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://developers.google.com/analytics/devguides/config/gmp/v1).
1 change: 1 addition & 0 deletions AdsMarketingPlatformAdmin/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.0
30 changes: 30 additions & 0 deletions AdsMarketingPlatformAdmin/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "google/ads-marketingplatform-admin",
"description": "Google Ads Marketing Platform Admin Client for PHP",
"license": "Apache-2.0",
"minimum-stability": "stable",
"autoload": {
"psr-4": {
"Google\\Ads\\MarketingPlatform\\Admin\\": "src",
"GPBMetadata\\Google\\Marketingplatform\\Admin\\": "metadata"
}
},
"extra": {
"component": {
"id": "ads-marketingplatform-admin",
"path": "AdsMarketingPlatformAdmin",
"target": "googleapis/php-ads-marketingplatform-admin"
}
},
"require": {
"php": "^8.0",
"google/gax": "^1.34.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."
}
}
Binary file not shown.
Binary file not shown.
47 changes: 47 additions & 0 deletions AdsMarketingPlatformAdmin/owlbot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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}/AdsMarketingPlatformAdmin").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)

# format generated clients
subprocess.run([
'npm',
'exec',
'--yes',
'--package=@prettier/plugin-php@^0.16',
'--',
'prettier',
'**/Client/*',
'--write',
'--parser=php',
'--single-quote',
'--print-width=120'])
16 changes: 16 additions & 0 deletions AdsMarketingPlatformAdmin/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory suffix=".php">src/V[!a-zA-Z]*</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Google Ads Marketing Platform Admin Unit Test Suite">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
</phpunit>
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?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 marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_CreateAnalyticsAccountLink_sync]
use Google\Ads\MarketingPlatform\Admin\V1alpha\AnalyticsAccountLink;
use Google\Ads\MarketingPlatform\Admin\V1alpha\Client\MarketingplatformAdminServiceClient;
use Google\Ads\MarketingPlatform\Admin\V1alpha\CreateAnalyticsAccountLinkRequest;
use Google\ApiCore\ApiException;

/**
* Creates the link between the Analytics account and the Google Marketing
* Platform organization.
*
* User needs to be an org user, and admin on the Analytics account to create
* the link. If the account is already linked to an organization, user needs
* to unlink the account from the current organization, then try link again.
*
* @param string $formattedParent The parent resource where this Analytics account link will be
* created. Format: organizations/{org_id}
* Please see {@see MarketingplatformAdminServiceClient::organizationName()} for help formatting this field.
* @param string $formattedAnalyticsAccountLinkAnalyticsAccount Immutable. The resource name of the AnalyticsAdmin API account.
* The account ID will be used as the ID of this AnalyticsAccountLink
* resource, which will become the final component of the resource name.
*
* Format: analyticsadmin.googleapis.com/accounts/{account_id}
* Please see {@see MarketingplatformAdminServiceClient::accountName()} for help formatting this field.
*/
function create_analytics_account_link_sample(
string $formattedParent,
string $formattedAnalyticsAccountLinkAnalyticsAccount
): void {
// Create a client.
$marketingplatformAdminServiceClient = new MarketingplatformAdminServiceClient();

// Prepare the request message.
$analyticsAccountLink = (new AnalyticsAccountLink())
->setAnalyticsAccount($formattedAnalyticsAccountLinkAnalyticsAccount);
$request = (new CreateAnalyticsAccountLinkRequest())
->setParent($formattedParent)
->setAnalyticsAccountLink($analyticsAccountLink);

// Call the API and handle any network failures.
try {
/** @var AnalyticsAccountLink $response */
$response = $marketingplatformAdminServiceClient->createAnalyticsAccountLink($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
{
$formattedParent = MarketingplatformAdminServiceClient::organizationName('[ORGANIZATION]');
$formattedAnalyticsAccountLinkAnalyticsAccount = MarketingplatformAdminServiceClient::accountName(
'[ACCOUNT]'
);

create_analytics_account_link_sample(
$formattedParent,
$formattedAnalyticsAccountLinkAnalyticsAccount
);
}
// [END marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_CreateAnalyticsAccountLink_sync]
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 marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_DeleteAnalyticsAccountLink_sync]
use Google\Ads\MarketingPlatform\Admin\V1alpha\Client\MarketingplatformAdminServiceClient;
use Google\Ads\MarketingPlatform\Admin\V1alpha\DeleteAnalyticsAccountLinkRequest;
use Google\ApiCore\ApiException;

/**
* Deletes the AnalyticsAccountLink, which detaches the Analytics account from
* the Google Marketing Platform organization.
*
* User needs to be an org user, and admin on the Analytics account in order
* to delete the link.
*
* @param string $formattedName The name of the Analytics account link to delete.
* Format:
* organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id}
* Please see {@see MarketingplatformAdminServiceClient::analyticsAccountLinkName()} for help formatting this field.
*/
function delete_analytics_account_link_sample(string $formattedName): void
{
// Create a client.
$marketingplatformAdminServiceClient = new MarketingplatformAdminServiceClient();

// Prepare the request message.
$request = (new DeleteAnalyticsAccountLinkRequest())
->setName($formattedName);

// Call the API and handle any network failures.
try {
$marketingplatformAdminServiceClient->deleteAnalyticsAccountLink($request);
printf('Call completed successfully.' . PHP_EOL);
} 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 = MarketingplatformAdminServiceClient::analyticsAccountLinkName(
'[ORGANIZATION]',
'[ANALYTICS_ACCOUNT_LINK]'
);

delete_analytics_account_link_sample($formattedName);
}
// [END marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_DeleteAnalyticsAccountLink_sync]
Loading

0 comments on commit 3c1abdb

Please sign in to comment.